Repository: NETMF/llilum
Branch: dev
Commit: 7ac7669fe205
Files: 3891
Total size: 46.4 MB
Directory structure:
gitextract_v7iyasqz/
├── .gitattributes
├── .gitignore
├── BuildEnv.props
├── LICENSE
├── LlilumSDK/
│ ├── GenerateFrameworkList/
│ │ ├── App.config
│ │ ├── GenerateFrameworkList.csproj
│ │ ├── Program.cs
│ │ └── Properties/
│ │ └── AssemblyInfo.cs
│ ├── LlilumSDK/
│ │ ├── BoardConfigurations.wxs
│ │ ├── Directories.wxs
│ │ ├── HarvestDirectories.targets
│ │ ├── LlilumSDK.wixproj
│ │ ├── LlilumSDKLic.rtf
│ │ ├── LlvmTools.wxs
│ │ ├── MarkComponentsWin32.xslt
│ │ ├── PreConditions.wxi
│ │ ├── Product.wxs
│ │ ├── ReferenceAssemblies.wxs
│ │ └── ToolsBin.wxs
│ ├── LlilumSDK.sln
│ └── readme.md
├── LlvmApplication.props
├── README.md
├── SDKHelpers/
│ ├── RunLillium.cmd
│ ├── output/
│ │ ├── CompileAndLink.bat
│ │ ├── RunLLVM.bat
│ │ └── makefile
│ └── setenv.cmd
├── Samples/
│ ├── I2cTemperatureSensor/
│ │ ├── I2cTemperatureSensor/
│ │ │ ├── Managed/
│ │ │ │ ├── Managed.csproj
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── README.txt
│ │ │ └── Native/
│ │ │ ├── Native.vcxproj
│ │ │ ├── Source.cpp
│ │ │ ├── mbed_simple_K64F.FrontEndConfig
│ │ │ ├── mbed_simple_LPC1768.FrontEndConfig
│ │ │ ├── mbed_simple_STM32L152.FrontEndConfig
│ │ │ └── pch.h
│ │ └── I2cTemperatureSensor.sln
│ ├── README.txt
│ └── SpiDisplay/
│ ├── SpiDisplay/
│ │ ├── Managed/
│ │ │ ├── Managed.csproj
│ │ │ ├── Program.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ └── README.txt
│ │ └── Native/
│ │ ├── Native.vcxproj
│ │ ├── Source.cpp
│ │ ├── mbed_simple_K64F.FrontEndConfig
│ │ ├── mbed_simple_LPC1768.FrontEndConfig
│ │ ├── mbed_simple_STM32L152.FrontEndConfig
│ │ └── pch.h
│ └── SpiDisplay.sln
├── VisualStudio/
│ ├── LlilumApplicationType/
│ │ └── Llilum/
│ │ ├── 1.0/
│ │ │ ├── 1033/
│ │ │ │ ├── AndroidDebugger.xml
│ │ │ │ ├── Llilum.xml
│ │ │ │ ├── ar.xml
│ │ │ │ ├── as.xml
│ │ │ │ ├── clang.xml
│ │ │ │ ├── clanglink.xml
│ │ │ │ ├── general_android.xml
│ │ │ │ ├── general_makefile_android.xml
│ │ │ │ └── nmake_android.xml
│ │ │ ├── Android.Common.props
│ │ │ ├── Android.Common.targets
│ │ │ ├── Android.Makefile.targets
│ │ │ ├── Android.NDK.props
│ │ │ ├── Android.STL.props
│ │ │ ├── Android.Tools.props
│ │ │ ├── Default.props
│ │ │ └── Platforms/
│ │ │ ├── ARM/
│ │ │ │ ├── Platform.Default.props
│ │ │ │ ├── Platform.props
│ │ │ │ ├── Platform.targets
│ │ │ │ └── PlatformToolsets/
│ │ │ │ └── Gcc/
│ │ │ │ ├── ImportAfter/
│ │ │ │ │ ├── armasm.props
│ │ │ │ │ └── armasm.targets
│ │ │ │ ├── Toolset.props
│ │ │ │ └── Toolset.targets
│ │ │ ├── Llilum_K64F.props
│ │ │ ├── Llilum_LPC1768.props
│ │ │ ├── Llilum_STM32F091.props
│ │ │ ├── Llilum_STM32F401.props
│ │ │ ├── Llilum_STM32F411.props
│ │ │ ├── Llilum_STM32L152.props
│ │ │ └── mbed-rtos.props
│ │ └── Default.props
│ └── LlilumProjectType/
│ ├── LlilumApplication/
│ │ ├── LlilumApplication.ProjectTemplate/
│ │ │ ├── LlilumApplication.ProjectTemplate.csproj
│ │ │ ├── LlilumApplication.vstemplate
│ │ │ ├── LlilumManaged/
│ │ │ │ ├── Managed.csproj
│ │ │ │ ├── MyTemplate.vstemplate
│ │ │ │ ├── Program.cs
│ │ │ │ └── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── LlilumNative/
│ │ │ │ ├── MyTemplate.vstemplate
│ │ │ │ ├── Native.vcxproj
│ │ │ │ ├── Source.cpp
│ │ │ │ ├── mbed_simple_K64F.FrontEndConfig
│ │ │ │ ├── mbed_simple_LPC1768.FrontEndConfig
│ │ │ │ ├── mbed_simple_STM32F091.FrontEndConfig
│ │ │ │ ├── mbed_simple_STM32F401.FrontEndConfig
│ │ │ │ ├── mbed_simple_STM32F411.FrontEndConfig
│ │ │ │ ├── mbed_simple_STM32L152.FrontEndConfig
│ │ │ │ └── pch.h
│ │ │ └── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ └── LlilumApplication.ProjectType/
│ │ ├── BuildSystem/
│ │ │ ├── DeployedBuildSystem/
│ │ │ │ ├── CustomProject.Default.props
│ │ │ │ ├── CustomProject.props
│ │ │ │ ├── CustomProject.targets
│ │ │ │ └── CustomProjectCs.targets
│ │ │ └── Rules/
│ │ │ ├── CustomPropertyPage.xaml
│ │ │ ├── LlilumDebugger.xaml
│ │ │ ├── ProjectItemsSchema.xaml
│ │ │ └── debugger_general.xaml
│ │ ├── Key.snk
│ │ ├── LlilumApplication.ProjectType.csproj
│ │ ├── LlilumDebuggerLaunchProvider.cs
│ │ ├── LlilumDeployProvider.cs
│ │ ├── LlilumHelpers.cs
│ │ ├── MITLicense.txt
│ │ ├── MyConfiguredProject.cs
│ │ ├── MyUnconfiguredProject.cs
│ │ ├── ProjectProperties.cs
│ │ ├── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── VSPackage.resx
│ │ ├── VsPackage.cs
│ │ ├── app.config
│ │ ├── packages.config
│ │ └── source.extension.vsixmanifest
│ ├── LlilumApplication.sln
│ ├── Microsoft.MIEngine.CoreRegisters.ARM/
│ │ ├── Converters/
│ │ │ ├── ExceptionNumberConverter.cs
│ │ │ ├── IntAsBinaryStringConverter.cs
│ │ │ └── IsNullValueConverter.cs
│ │ ├── CoreRegistersWindow.cs
│ │ ├── CoreRegistersWindowCommand.cs
│ │ ├── CoreRegistersWindowControl.xaml
│ │ ├── CoreRegistersWindowControl.xaml.cs
│ │ ├── Key.snk
│ │ ├── MIEngineResultsParsers.cs
│ │ ├── MITLicense.txt
│ │ ├── Microsoft.MIEngine.CoreRegisters.ARM.csproj
│ │ ├── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── VSPackage.resx
│ │ ├── ViewModel/
│ │ │ ├── CoreRegisterViewModel.cs
│ │ │ ├── CoreRegistersViewModel.cs
│ │ │ └── XpsrRegisterDetailsViewModel.cs
│ │ ├── VsPackage.cs
│ │ ├── VsPackage.vsct
│ │ ├── packages.config
│ │ └── source.extension.vsixmanifest
│ └── Microsoft.MIEngine.CoreRegisters.ARMTests/
│ ├── IntAsBinaryStringConverterTests.cs
│ ├── MIEngineResultParsersTests.cs
│ ├── Microsoft.MIEngine.CoreRegisters.ARMTests.csproj
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── Zelig/
│ ├── BoardConfigurations/
│ │ ├── BoardConfigurations.sln
│ │ ├── K64F/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ ├── NetworkInterfaceProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── K64F.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── K64F.FrontEndConfig
│ │ │ ├── K64FConfiguration.csproj
│ │ │ └── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── LPC1768/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── LPC1768.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── LPC1768.FrontEndConfig
│ │ │ ├── LPC1768Configuration.csproj
│ │ │ └── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── STM32F091/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── STM32F091.csproj
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── STM32F091.FrontEndConfig
│ │ │ └── STM32F091Configuration.csproj
│ │ ├── STM32F401/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── STM32F401.csproj
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── STM32F401.FrontEndConfig
│ │ │ └── STM32F401Configuration.csproj
│ │ ├── STM32F411/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── STM32F411.csproj
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── STM32F411.FrontEndConfig
│ │ │ └── STM32F411Configuration.csproj
│ │ ├── STM32L152/
│ │ │ ├── Board/
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Board.cs
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ ├── HardwareProvidersUwp/
│ │ │ │ │ │ ├── AdcProviderUwp.cs
│ │ │ │ │ │ ├── I2cProviderUwp.cs
│ │ │ │ │ │ ├── PwmProviderUwp.cs
│ │ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ └── Processor.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── STM32L152.csproj
│ │ │ │ └── SystemServices/
│ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ ├── ThreadManager.cs
│ │ │ │ └── TimerPool.cs
│ │ │ └── Configuration/
│ │ │ ├── Configuration.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── STM32L152.FrontEndConfig
│ │ │ └── STM32L152Configuration.csproj
│ │ └── Win32/
│ │ └── Configuration/
│ │ ├── Configuration.cs
│ │ ├── Properties/
│ │ │ └── AssemblyInfo.cs
│ │ ├── Win32.FrontEndConfig
│ │ └── Win32Configuration.csproj
│ ├── LLVM2IR_results/
│ │ └── mbed/
│ │ ├── common_files/
│ │ │ └── temporary_helper.c
│ │ ├── mbed_rtos/
│ │ │ ├── GpioInterrupts/
│ │ │ │ ├── Makefile
│ │ │ │ ├── buildK64F.bat
│ │ │ │ ├── buildLPC1768.bat
│ │ │ │ └── main.cpp
│ │ │ └── ReadMe.txt
│ │ ├── simple/
│ │ │ ├── .gdbinit
│ │ │ ├── DebugOptions.xml
│ │ │ ├── build.bat
│ │ │ ├── buildK64F.bat
│ │ │ ├── buildLPC1768.bat
│ │ │ ├── buildSTM32F091.bat
│ │ │ ├── buildSTM32F401.bat
│ │ │ ├── buildSTM32F411.bat
│ │ │ ├── buildSTM32L152.bat
│ │ │ ├── buildWin32.bat
│ │ │ ├── buildmake.bat
│ │ │ ├── debug.bat
│ │ │ ├── debugK64F.bat
│ │ │ ├── debugLPC1768.bat
│ │ │ ├── debugSTM32F091.bat
│ │ │ ├── debugSTM32F401.bat
│ │ │ ├── debugSTM32F411.bat
│ │ │ ├── debugSTM32L152.bat
│ │ │ ├── deploy.bat
│ │ │ ├── deployK64F.bat
│ │ │ ├── deployLPC1768.bat
│ │ │ ├── deploySTM32F091.bat
│ │ │ ├── deploySTM32F401.bat
│ │ │ ├── deploySTM32F411.bat
│ │ │ ├── deploySTM32L152.bat
│ │ │ ├── helpers.h
│ │ │ └── makefile
│ │ └── test/
│ │ ├── build.bat
│ │ ├── buildK64F.bat
│ │ ├── buildLPC1768.bat
│ │ ├── debug.bat
│ │ ├── debugK64F.bat
│ │ ├── debugLPC1768.bat
│ │ ├── deploy.bat
│ │ ├── deployK64F.bat
│ │ ├── deployLPC1768.bat
│ │ └── makefile
│ ├── Zelig/
│ │ ├── CompileTime/
│ │ │ ├── AnalysisTools/
│ │ │ │ ├── IRCompare/
│ │ │ │ │ ├── IRCompare.csproj
│ │ │ │ │ ├── MainForm.Designer.cs
│ │ │ │ │ ├── MainForm.cs
│ │ │ │ │ ├── MainForm.resx
│ │ │ │ │ ├── MethodViewer.Designer.cs
│ │ │ │ │ ├── MethodViewer.cs
│ │ │ │ │ ├── MethodViewer.resx
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ │ │ ├── Resources.Designer.cs
│ │ │ │ │ │ ├── Resources.resx
│ │ │ │ │ │ ├── Settings.Designer.cs
│ │ │ │ │ │ └── Settings.settings
│ │ │ │ │ ├── RenderMethod.cs
│ │ │ │ │ └── app.config
│ │ │ │ ├── IRViewer/
│ │ │ │ │ ├── IRViewer.csproj
│ │ │ │ │ ├── MainForm.Designer.cs
│ │ │ │ │ ├── MainForm.cs
│ │ │ │ │ ├── MainForm.resx
│ │ │ │ │ ├── Parser.cs
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ │ │ ├── Resources.Designer.cs
│ │ │ │ │ │ ├── Resources.resx
│ │ │ │ │ │ ├── Settings.Designer.cs
│ │ │ │ │ │ └── Settings.settings
│ │ │ │ │ └── SourceCodeTracker.cs
│ │ │ │ └── InequalityGraphVisualization/
│ │ │ │ ├── GraphForm.Designer.cs
│ │ │ │ ├── GraphForm.cs
│ │ │ │ ├── GraphForm.resx
│ │ │ │ ├── InequalityGraphVisualization.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── Viewer.cs
│ │ │ ├── CodeGenerator/
│ │ │ │ ├── CodeGenerator.UnitTest/
│ │ │ │ │ ├── BaseTester.cs
│ │ │ │ │ ├── Bench.cs
│ │ │ │ │ ├── CodeGenerationTester.cs
│ │ │ │ │ ├── CodeGenerator.UnitTest.csproj
│ │ │ │ │ ├── GenericInstantiationClosureTester.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── SerializationSpeedTester.cs
│ │ │ │ │ ├── TypeSystemPopulationTester.cs
│ │ │ │ │ └── app.config
│ │ │ │ ├── CodeTransformation/
│ │ │ │ │ ├── Abstractions/
│ │ │ │ │ │ ├── CallingConvention.cs
│ │ │ │ │ │ ├── ExternalCallContext.cs
│ │ │ │ │ │ ├── PlacementRequirements.cs
│ │ │ │ │ │ ├── Platform.cs
│ │ │ │ │ │ ├── RegisterClass.cs
│ │ │ │ │ │ └── RegisterDescriptor.cs
│ │ │ │ │ ├── Annotations/
│ │ │ │ │ │ ├── InliningPathAnnotation.cs
│ │ │ │ │ │ ├── RegisterAllocationConstraintAnnotation.cs
│ │ │ │ │ │ └── RegisterCouplingConstraintAnnotation.cs
│ │ │ │ │ ├── BitFieldDefinition.cs
│ │ │ │ │ ├── CodeTransformation.csproj
│ │ │ │ │ ├── CompilationSteps/
│ │ │ │ │ │ ├── Attributes/
│ │ │ │ │ │ │ ├── AbstractHandlerAttribute.cs
│ │ │ │ │ │ │ ├── CallClosureHandlerAttribute.cs
│ │ │ │ │ │ │ ├── CallToWellKnownMethodHandlerAttribute.cs
│ │ │ │ │ │ │ ├── CustomAttributeHandlerAttribute.cs
│ │ │ │ │ │ │ ├── CustomAttributeNotificationAttribute.cs
│ │ │ │ │ │ │ ├── MaximumOperatorLevelAfterPhaseExecutionAttribute.cs
│ │ │ │ │ │ │ ├── NewEntityNotificationAttribute.cs
│ │ │ │ │ │ │ ├── OperatorArgumentHandlerAttribute.cs
│ │ │ │ │ │ │ ├── OperatorHandlerAttribute.cs
│ │ │ │ │ │ │ ├── OptimizationHandlerAttribute.cs
│ │ │ │ │ │ │ ├── PhaseDisabledAttribute.cs
│ │ │ │ │ │ │ ├── PhaseFilterAttribute.cs
│ │ │ │ │ │ │ ├── PhaseLimitAttribute.cs
│ │ │ │ │ │ │ ├── PhaseOrderingAttribute.cs
│ │ │ │ │ │ │ ├── PostFlowGraphHandlerAttribute.cs
│ │ │ │ │ │ │ ├── PostPhaseHandlerAttribute.cs
│ │ │ │ │ │ │ ├── PreFlowGraphHandlerAttribute.cs
│ │ │ │ │ │ │ ├── PrePhaseHandlerAttribute.cs
│ │ │ │ │ │ │ ├── WellKnownFieldHandlerAttribute.cs
│ │ │ │ │ │ │ ├── WellKnownMethodHandlerAttribute.cs
│ │ │ │ │ │ │ └── WellKnownTypeHandlerAttribute.cs
│ │ │ │ │ │ ├── Controller.cs
│ │ │ │ │ │ ├── Handlers/
│ │ │ │ │ │ │ ├── MethodTransformations.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_ConvertUnsupportedOperatorsToMethodCalls.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_ExpandAggregateTypes.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_FromImplicitToExplicitExceptions.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_HighLevel.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_HighLevelToMidLevel.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_MidLevelToLowLevel.cs
│ │ │ │ │ │ │ ├── OperatorHandlers_ReferenceCountingGarbageCollection.cs
│ │ │ │ │ │ │ ├── Optimizations.cs
│ │ │ │ │ │ │ ├── ProtectRequiredEntities.cs
│ │ │ │ │ │ │ ├── SoftwareFloatingPoint.cs
│ │ │ │ │ │ │ ├── WellKnownFieldHandlers.cs
│ │ │ │ │ │ │ └── WellKnownMethodHandlers.cs
│ │ │ │ │ │ ├── PhaseDrivers/
│ │ │ │ │ │ │ ├── ApplyClassExtensions.cs
│ │ │ │ │ │ │ ├── CallGraph.cs
│ │ │ │ │ │ │ ├── CallsDatabase.cs
│ │ │ │ │ │ │ ├── ComputeCallsClosure.cs
│ │ │ │ │ │ │ ├── DelegationCache.cs
│ │ │ │ │ │ │ ├── DetectFieldInvariants.cs
│ │ │ │ │ │ │ ├── ImplementExternalMethods.cs
│ │ │ │ │ │ │ ├── ImplementInternalMethods.cs
│ │ │ │ │ │ │ ├── ImplementInternalMethods_Delegate.cs
│ │ │ │ │ │ │ ├── ImplementInternalMethods_ExternalMethodStub.cs
│ │ │ │ │ │ │ ├── ImplementInternalMethods_ObjectEquals.cs
│ │ │ │ │ │ │ ├── ImplementInternalMethods_SingletonFactory.cs
│ │ │ │ │ │ │ ├── OptimizationsPhaseExecution.cs
│ │ │ │ │ │ │ ├── ParallelTransformationsHandler.cs
│ │ │ │ │ │ │ ├── PhaseDriver.cs
│ │ │ │ │ │ │ ├── PhaseExecution.cs
│ │ │ │ │ │ │ └── SingleMethodPhaseExecution.cs
│ │ │ │ │ │ └── Phases/
│ │ │ │ │ │ ├── AllocateRegisters.cs
│ │ │ │ │ │ ├── ApplyClassExtensions.cs
│ │ │ │ │ │ ├── ApplyConfigurationSettings.cs
│ │ │ │ │ │ ├── CollectRegisterAllocationConstraints.cs
│ │ │ │ │ │ ├── CompleteImplementationOfInternalMethods.cs
│ │ │ │ │ │ ├── ComputeCallsClosure.cs
│ │ │ │ │ │ ├── ConvertToSSA.cs
│ │ │ │ │ │ ├── ConvertUnsupportedOperatorsToMethodCalls.cs
│ │ │ │ │ │ ├── CrossReferenceTypeSystem.cs
│ │ │ │ │ │ ├── DetectNonImplementedInternalCalls.cs
│ │ │ │ │ │ ├── Done.cs
│ │ │ │ │ │ ├── EstimateTypeSystemReduction.cs
│ │ │ │ │ │ ├── ExpandAggregateTypes.cs
│ │ │ │ │ │ ├── FromImplicitToExplicitExceptions.cs
│ │ │ │ │ │ ├── FuseOperators.cs
│ │ │ │ │ │ ├── GenerateImage.cs
│ │ │ │ │ │ ├── HighLevelToMidLevelConversion.cs
│ │ │ │ │ │ ├── HighLevelTransformations.cs
│ │ │ │ │ │ ├── LayoutTypes.cs
│ │ │ │ │ │ ├── MidLevelToLowLevelConversion.cs
│ │ │ │ │ │ ├── Optimizations.cs
│ │ │ │ │ │ ├── OrderStaticConstructors.cs
│ │ │ │ │ │ ├── PrepareExternalMethods.cs
│ │ │ │ │ │ ├── PrepareForRegisterAllocation.cs
│ │ │ │ │ │ ├── PrepareImplementationOfInternalMethods.cs
│ │ │ │ │ │ ├── PropagateCompilationConstraints.cs
│ │ │ │ │ │ ├── ReduceNumberOfTemporaries.cs
│ │ │ │ │ │ ├── ReduceTypeSystem.cs
│ │ │ │ │ │ ├── ReferenceCountingGarbageCollection.cs
│ │ │ │ │ │ ├── ResourceManagerOptimizations.cs
│ │ │ │ │ │ ├── SplitComplexOperators.cs
│ │ │ │ │ │ └── TransformFinallyBlocksIntoTryBlocks.cs
│ │ │ │ │ ├── ControlFlowGraphState/
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_CompilationConstraintsLookup.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_Dominance.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_Liveness.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_MapToMachine.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_PostDominance.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_PostOrderVisit.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_PropertiesOfVariables.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_ReachingDefinitions.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_SpanningTree.cs
│ │ │ │ │ │ ├── ControlFlowGraphStateForCodeTransformation_Trace.cs
│ │ │ │ │ │ └── ControlFlowGraphStateForCodeTransformation_UseDefinitionChains.cs
│ │ │ │ │ ├── DataFlow/
│ │ │ │ │ │ ├── ControlTree/
│ │ │ │ │ │ │ ├── Dominance.cs
│ │ │ │ │ │ │ ├── GenericDepthFirst.cs
│ │ │ │ │ │ │ ├── NaturalLoops.cs
│ │ │ │ │ │ │ ├── PostDominance.cs
│ │ │ │ │ │ │ ├── PostOrderVisit.cs
│ │ │ │ │ │ │ └── SpanningTree.cs
│ │ │ │ │ │ ├── LivenessAnalysis.cs
│ │ │ │ │ │ └── ReachingDefinitions.cs
│ │ │ │ │ ├── DataManager.cs
│ │ │ │ │ ├── Expressions/
│ │ │ │ │ │ ├── ConditionCodeExpression.cs
│ │ │ │ │ │ ├── LowLevelVariableExpression.cs
│ │ │ │ │ │ ├── PhiVariableExpression.cs
│ │ │ │ │ │ ├── PhysicalRegisterExpression.cs
│ │ │ │ │ │ ├── PseudoRegisterExpression.cs
│ │ │ │ │ │ ├── StackLocationExpression.cs
│ │ │ │ │ │ └── TypedPhysicalRegisterExpression.cs
│ │ │ │ │ ├── ExternalDataDescriptor.cs
│ │ │ │ │ ├── ExternalMethodImporters/
│ │ │ │ │ │ ├── ArmElfContext.cs
│ │ │ │ │ │ ├── ArmElfDataContext.cs
│ │ │ │ │ │ └── ArmElfMethodContext.cs
│ │ │ │ │ ├── ImageBuilders/
│ │ │ │ │ │ ├── CodeConstant.cs
│ │ │ │ │ │ ├── CompilationState.cs
│ │ │ │ │ │ ├── CompilationState_EmitCode.cs
│ │ │ │ │ │ ├── CompilationState_Encoder.cs
│ │ │ │ │ │ ├── CompilationState_ExceptionMap.cs
│ │ │ │ │ │ ├── CompilationState_Scheduling.cs
│ │ │ │ │ │ ├── Core.cs
│ │ │ │ │ │ ├── ImageAnnotations/
│ │ │ │ │ │ │ ├── CodeRelocation.cs
│ │ │ │ │ │ │ ├── DataRelocation.cs
│ │ │ │ │ │ │ ├── ExternMethodCallRelocation.cs
│ │ │ │ │ │ │ ├── ExternalDataRelocation.cs
│ │ │ │ │ │ │ ├── GenericImageAnnotation.cs
│ │ │ │ │ │ │ ├── ImageAnnotation.cs
│ │ │ │ │ │ │ └── TrackVariableLifetime.cs
│ │ │ │ │ │ └── SequentialRegion.cs
│ │ │ │ │ ├── IntermediateRepresentationDumper.cs
│ │ │ │ │ ├── LLVM/
│ │ │ │ │ │ ├── DebugInfoExtensions.cs
│ │ │ │ │ │ ├── ITargetSectionOptions.cs
│ │ │ │ │ │ ├── InliningPathAnnotationExtensions.cs
│ │ │ │ │ │ ├── LLVMModuleManager.cs
│ │ │ │ │ │ ├── LLVMModuleManager_Types.cs
│ │ │ │ │ │ ├── SectionNameProvider.cs
│ │ │ │ │ │ ├── TypeField.cs
│ │ │ │ │ │ ├── ValueExtensions.cs
│ │ │ │ │ │ ├── _BasicBlock.cs
│ │ │ │ │ │ ├── _Function.cs
│ │ │ │ │ │ ├── _Module.cs
│ │ │ │ │ │ └── _Type.cs
│ │ │ │ │ ├── Operators/
│ │ │ │ │ │ ├── BinaryOperatorWithCarryIn.cs
│ │ │ │ │ │ ├── BinaryOperatorWithCarryInAndOut.cs
│ │ │ │ │ │ ├── BinaryOperatorWithCarryOut.cs
│ │ │ │ │ │ ├── BitTestOperator.cs
│ │ │ │ │ │ ├── Calls/
│ │ │ │ │ │ │ ├── DirectSubroutineOperator.cs
│ │ │ │ │ │ │ ├── IndirectSubroutineOperator.cs
│ │ │ │ │ │ │ └── SubroutineOperator.cs
│ │ │ │ │ │ ├── CompareOperator.cs
│ │ │ │ │ │ ├── ConditionalCompareOperator.cs
│ │ │ │ │ │ ├── Control/
│ │ │ │ │ │ │ └── ConditionCodeControlOperator.cs
│ │ │ │ │ │ ├── InitialValueOperator.cs
│ │ │ │ │ │ ├── LongCompareOperator.cs
│ │ │ │ │ │ ├── NewConstraintOperator.cs
│ │ │ │ │ │ ├── PhiOperator.cs
│ │ │ │ │ │ ├── PiOperator.cs
│ │ │ │ │ │ ├── SetIfConditionIsTrueOperator.cs
│ │ │ │ │ │ └── UnaryOperatorWithCarryOut.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── SourceCodeTracker.cs
│ │ │ │ │ ├── TransformationContextForCodeTransformation.cs
│ │ │ │ │ ├── Transformations/
│ │ │ │ │ │ ├── CommonMethodRedundancyElimination.cs
│ │ │ │ │ │ ├── ConstraintSystemCollector.cs
│ │ │ │ │ │ ├── ConvertToLandingPads.cs
│ │ │ │ │ │ ├── GlobalCopyPropagation.cs
│ │ │ │ │ │ ├── GlobalRegisterAllocation.cs
│ │ │ │ │ │ ├── InlineCall.cs
│ │ │ │ │ │ ├── InlineScalars.cs
│ │ │ │ │ │ ├── MergeExtendedBasicBlocks.cs
│ │ │ │ │ │ ├── PerformClassExtension.cs
│ │ │ │ │ │ ├── ReduceNumberOfTemporaries.cs
│ │ │ │ │ │ ├── RemoveDeadCode.cs
│ │ │ │ │ │ ├── RemoveSimpleIndirections.cs
│ │ │ │ │ │ ├── SimplifyConditionCodeChecks.cs
│ │ │ │ │ │ ├── SplitBasicBlocksAtExceptionSites.cs
│ │ │ │ │ │ ├── StaticSingleAssignmentForm.cs
│ │ │ │ │ │ ├── TransformFinallyBlocksIntoTryBlocks.cs
│ │ │ │ │ │ └── TypeSystemIntrospection/
│ │ │ │ │ │ ├── CollectUsageContext.cs
│ │ │ │ │ │ ├── LocateFieldsInCode.cs
│ │ │ │ │ │ ├── LocateUsageInCode.cs
│ │ │ │ │ │ ├── RemapTypeSystem.cs
│ │ │ │ │ │ ├── ReverseIndexTypeSystem.cs
│ │ │ │ │ │ ├── ScanCode.cs
│ │ │ │ │ │ ├── ScanCodeWithCallback.cs
│ │ │ │ │ │ └── ScanTypeSystem.cs
│ │ │ │ │ ├── TypeSystemForCodeTransformation.cs
│ │ │ │ │ ├── TypeSystemForCodeTransformation_Notifications.cs
│ │ │ │ │ └── TypeSystemSerializer.cs
│ │ │ │ ├── FrontEnd/
│ │ │ │ │ ├── Bench.cs
│ │ │ │ │ ├── FrontEnd.csproj
│ │ │ │ │ ├── Legacy/
│ │ │ │ │ │ ├── NohauLPC3180Loader.FrontEndConfig
│ │ │ │ │ │ ├── VoxSoloFormFactorLoader.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_Bootstrap_FF.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_Bootstrap_NXP.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_Tester_FF.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_Tester_NXP.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_UnitTest_FF.FrontEndConfig
│ │ │ │ │ │ ├── VoxSolo_UnitTest_NXP.FrontEndConfig
│ │ │ │ │ │ ├── iMote2Loader.FrontEndConfig
│ │ │ │ │ │ ├── iMoteQuickTest_Tester.FrontEndConfig
│ │ │ │ │ │ ├── mscorlib_unittest_FF.FrontEndConfig
│ │ │ │ │ │ ├── mscorlib_unittest_NXP.FrontEndConfig
│ │ │ │ │ │ ├── mscorlib_unittest_PXA.FrontEndConfig
│ │ │ │ │ │ ├── tester_FF.FrontEndConfig
│ │ │ │ │ │ ├── tester_NXP.FrontEndConfig
│ │ │ │ │ │ └── tester_PXA.FrontEndConfig
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Test/
│ │ │ │ │ │ ├── Dhrystone_perf_test.FrontEndConfig
│ │ │ │ │ │ ├── ExternalLinking_Tester.FrontEndConfig
│ │ │ │ │ │ ├── FileSystemSample.FrontEndConfig
│ │ │ │ │ │ ├── FileSystem_Tester.FrontEndConfig
│ │ │ │ │ │ ├── LLVM_test.FrontEndConfig
│ │ │ │ │ │ ├── Whetstone_perf_test.FrontEndConfig
│ │ │ │ │ │ ├── crypto_perf_test.FrontEndConfig
│ │ │ │ │ │ ├── mbed_gpio_test.FrontEndConfig
│ │ │ │ │ │ ├── mbed_serialport_test.FrontEndConfig
│ │ │ │ │ │ └── test.FrontEndConfig
│ │ │ │ │ ├── mbed_common.FrontEndConfig
│ │ │ │ │ ├── mbed_common_K64F.FrontEndConfig
│ │ │ │ │ ├── mbed_common_LPC1768.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_HTTP_K64F.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_K64F.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_LPC1768.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_LPC1768_Tester.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_NETMF_LPC1768.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_NET_K64F.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_NET_K64F_Tester.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_STM32F091.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_STM32F401.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_STM32F411.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_STM32L152.FrontEndConfig
│ │ │ │ │ ├── mbed_simple_Win32.FrontEndConfig
│ │ │ │ │ └── mbed_simple_Win32_Tester.FrontEndConfig
│ │ │ │ └── IntermediateRepresentation/
│ │ │ │ ├── Annotations/
│ │ │ │ │ ├── Annotation.cs
│ │ │ │ │ ├── ArrayLengthAnnotation.cs
│ │ │ │ │ ├── BlockCopyPropagationAnnotation.cs
│ │ │ │ │ ├── DontRemoveAnnotation.cs
│ │ │ │ │ ├── ExternalCallArgumentAnnotation.cs
│ │ │ │ │ ├── FixedLengthArrayAnnotation.cs
│ │ │ │ │ ├── IInliningPathAnnotation.cs
│ │ │ │ │ ├── InvalidationAnnotation.cs
│ │ │ │ │ ├── MemoryMappedPeripheralAnnotation.cs
│ │ │ │ │ ├── NotNullAnnotation.cs
│ │ │ │ │ ├── PostInvalidationAnnotation.cs
│ │ │ │ │ └── PreInvalidationAnnotation.cs
│ │ │ │ ├── BasicBlocks/
│ │ │ │ │ ├── BasicBlock.cs
│ │ │ │ │ ├── BasicBlockEdge.cs
│ │ │ │ │ ├── BasicBlockEdgeClass.cs
│ │ │ │ │ ├── Cloning/
│ │ │ │ │ │ ├── CloneForwardGraph.cs
│ │ │ │ │ │ ├── CloneForwardGraphButLinkToExceptionHandlers.cs
│ │ │ │ │ │ ├── CloneSingleBasicBlock.cs
│ │ │ │ │ │ └── CloningContext.cs
│ │ │ │ │ ├── CompilationConstraints.cs
│ │ │ │ │ ├── ControlFlowGraphState.cs
│ │ │ │ │ ├── EntryBasicBlock.cs
│ │ │ │ │ ├── ExceptionClause.cs
│ │ │ │ │ ├── ExceptionHandlerBasicBlock.cs
│ │ │ │ │ ├── ExitBasicBlock.cs
│ │ │ │ │ └── NormalBasicBlock.cs
│ │ │ │ ├── ByteCode/
│ │ │ │ │ ├── ByteCodeBlock.cs
│ │ │ │ │ ├── ByteCodeConverter.cs
│ │ │ │ │ ├── ByteCodeConverter_Helpers.cs
│ │ │ │ │ └── ByteCodeConverter_ProcessInstruction.cs
│ │ │ │ ├── Expressions/
│ │ │ │ │ ├── ArgumentVariableExpression.cs
│ │ │ │ │ ├── ConstantExpression.cs
│ │ │ │ │ ├── ExceptionObjectVariableExpression.cs
│ │ │ │ │ ├── Expression.cs
│ │ │ │ │ ├── LocalVariableExpression.cs
│ │ │ │ │ ├── TemporaryVariableExpression.cs
│ │ │ │ │ └── VariableExpression.cs
│ │ │ │ ├── IIntermediateRepresentationDumper.cs
│ │ │ │ ├── IntermediateRepresentation.csproj
│ │ │ │ ├── Operators/
│ │ │ │ │ ├── AbstractAssignmentOperator.cs
│ │ │ │ │ ├── AbstractBinaryOperator.cs
│ │ │ │ │ ├── AbstractUnaryOperator.cs
│ │ │ │ │ ├── BinaryOperator.cs
│ │ │ │ │ ├── Call/
│ │ │ │ │ │ ├── AddActivationRecordEventOperator.cs
│ │ │ │ │ │ ├── CallOperator.cs
│ │ │ │ │ │ ├── ExternalCallOperator.cs
│ │ │ │ │ │ ├── IndirectCallOperator.cs
│ │ │ │ │ │ ├── InstanceCallOperator.cs
│ │ │ │ │ │ └── StaticCallOperator.cs
│ │ │ │ │ ├── Checks/
│ │ │ │ │ │ ├── NullCheckOperator.cs
│ │ │ │ │ │ ├── OutOfBoundCheckOperator.cs
│ │ │ │ │ │ └── OverflowCheckOperator.cs
│ │ │ │ │ ├── CompareAndSetOperator.cs
│ │ │ │ │ ├── CompilationConstraintsOperator.cs
│ │ │ │ │ ├── Control/
│ │ │ │ │ │ ├── BinaryConditionalControlOperator.cs
│ │ │ │ │ │ ├── CompareConditionalControlOperator.cs
│ │ │ │ │ │ ├── ConditionalControlOperator.cs
│ │ │ │ │ │ ├── ControlOperator.cs
│ │ │ │ │ │ ├── DeadControlOperator.cs
│ │ │ │ │ │ ├── EndFinallyControlOperator.cs
│ │ │ │ │ │ ├── LeaveControlOperator.cs
│ │ │ │ │ │ ├── MultiWayConditionalControlOperator.cs
│ │ │ │ │ │ ├── ResumeUnwindOperator.cs
│ │ │ │ │ │ ├── RethrowControlOperator.cs
│ │ │ │ │ │ ├── ReturnControlOperator.cs
│ │ │ │ │ │ ├── ThrowControlOperator.cs
│ │ │ │ │ │ └── UnconditionalControlOperator.cs
│ │ │ │ │ ├── ConversionOperator.cs
│ │ │ │ │ ├── ConvertOperator.cs
│ │ │ │ │ ├── FetchExceptionOperator.cs
│ │ │ │ │ ├── LandingPadOperator.cs
│ │ │ │ │ ├── LongBinaryOperator.cs
│ │ │ │ │ ├── Memory/
│ │ │ │ │ │ ├── AddressAssignmentOperator.cs
│ │ │ │ │ │ ├── ArgListOperator.cs
│ │ │ │ │ │ ├── ElementOperator.cs
│ │ │ │ │ │ ├── FieldOperator.cs
│ │ │ │ │ │ ├── IndirectOperator.cs
│ │ │ │ │ │ ├── LoadAddressOperator.cs
│ │ │ │ │ │ ├── LoadElementAddressOperator.cs
│ │ │ │ │ │ ├── LoadElementOperator.cs
│ │ │ │ │ │ ├── LoadFieldOperator.cs
│ │ │ │ │ │ ├── LoadIndirectOperator.cs
│ │ │ │ │ │ ├── LoadInstanceFieldAddressOperator.cs
│ │ │ │ │ │ ├── LoadInstanceFieldOperator.cs
│ │ │ │ │ │ ├── LoadStaticFieldAddressOperator.cs
│ │ │ │ │ │ ├── LoadStaticFieldOperator.cs
│ │ │ │ │ │ ├── StackAllocationOperator.cs
│ │ │ │ │ │ ├── StoreElementOperator.cs
│ │ │ │ │ │ ├── StoreFieldOperator.cs
│ │ │ │ │ │ ├── StoreIndirectOperator.cs
│ │ │ │ │ │ ├── StoreInstanceFieldOperator.cs
│ │ │ │ │ │ └── StoreStaticFieldOperator.cs
│ │ │ │ │ ├── NopOperator.cs
│ │ │ │ │ ├── Object/
│ │ │ │ │ │ ├── ArrayAllocationOperator.cs
│ │ │ │ │ │ ├── ArrayLengthOperator.cs
│ │ │ │ │ │ ├── BoxOperator.cs
│ │ │ │ │ │ ├── CastOperator.cs
│ │ │ │ │ │ ├── IsInstanceOperator.cs
│ │ │ │ │ │ ├── MethodRepresentationOperator.cs
│ │ │ │ │ │ ├── ObjectAllocationOperator.cs
│ │ │ │ │ │ └── UnboxOperator.cs
│ │ │ │ │ ├── Operator.cs
│ │ │ │ │ ├── PartialAssignmentOperator.cs
│ │ │ │ │ ├── SignExtendOperator.cs
│ │ │ │ │ ├── SingleAssignmentOperator.cs
│ │ │ │ │ ├── TruncateOperator.cs
│ │ │ │ │ ├── TypedReference/
│ │ │ │ │ │ ├── MkRefAnyOperator.cs
│ │ │ │ │ │ ├── RefAnyTypeOperator.cs
│ │ │ │ │ │ └── RefAnyValOperator.cs
│ │ │ │ │ ├── UnaryOperator.cs
│ │ │ │ │ └── ZeroExtendOperator.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── TransformationContextForIR.cs
│ │ │ │ └── TypeSystemForIR.cs
│ │ │ ├── Llvm.NET/
│ │ │ │ ├── LibLLVM/
│ │ │ │ │ ├── AnalysisBindings.cpp
│ │ │ │ │ ├── AnalysisBindings.h
│ │ │ │ │ ├── AttributeBindings.cpp
│ │ │ │ │ ├── AttributeBindings.h
│ │ │ │ │ ├── BuildLlvmWithVS.cmd
│ │ │ │ │ ├── DIBuilderBindings.cpp
│ │ │ │ │ ├── DIBuilderBindings.h
│ │ │ │ │ ├── DITypeBindings.cpp
│ │ │ │ │ ├── DITypeBindings.h
│ │ │ │ │ ├── EXPORTS.DEF
│ │ │ │ │ ├── IRBindings.cpp
│ │ │ │ │ ├── IRBindings.h
│ │ │ │ │ ├── InlinedExports.cpp
│ │ │ │ │ ├── InlinedExports.h
│ │ │ │ │ ├── InstrumentationBindings.cpp
│ │ │ │ │ ├── InstrumentationBindings.h
│ │ │ │ │ ├── LibLLVM.vcxproj
│ │ │ │ │ ├── LibLLVM.vcxproj.filters
│ │ │ │ │ ├── LlvmApplication.props
│ │ │ │ │ ├── LlvmApplication.targets
│ │ │ │ │ ├── LlvmDebugInfo.cpp
│ │ │ │ │ ├── LlvmDebugInfo.h
│ │ │ │ │ ├── ModuleBindings.cpp
│ │ │ │ │ ├── ModuleBindings.h
│ │ │ │ │ ├── Resource.rc
│ │ │ │ │ ├── ValueBindings.cpp
│ │ │ │ │ ├── ValueBindings.h
│ │ │ │ │ ├── resource.h
│ │ │ │ │ ├── stdafx.h
│ │ │ │ │ └── targetver.h
│ │ │ │ ├── Llvm.NET/
│ │ │ │ │ ├── ArgValidationExtensions.cs
│ │ │ │ │ ├── Context.cs
│ │ │ │ │ ├── ContextValidator.cs
│ │ │ │ │ ├── DataLayout.cs
│ │ │ │ │ ├── DebugInfo/
│ │ │ │ │ │ ├── DIBasicType.cs
│ │ │ │ │ │ ├── DICompileUnit.cs
│ │ │ │ │ │ ├── DICompositeType.cs
│ │ │ │ │ │ ├── DIDerivedType.cs
│ │ │ │ │ │ ├── DIEnumerator.cs
│ │ │ │ │ │ ├── DIExpression.cs
│ │ │ │ │ │ ├── DIFile.cs
│ │ │ │ │ │ ├── DIGlobalVariable.cs
│ │ │ │ │ │ ├── DIImportedEntity.cs
│ │ │ │ │ │ ├── DILexicalBlock.cs
│ │ │ │ │ │ ├── DILexicalBlockBase.cs
│ │ │ │ │ │ ├── DILexicalBlockFile.cs
│ │ │ │ │ │ ├── DILocalScope.cs
│ │ │ │ │ │ ├── DILocalVariable.cs
│ │ │ │ │ │ ├── DILocation.cs
│ │ │ │ │ │ ├── DIModule.cs
│ │ │ │ │ │ ├── DINamespace.cs
│ │ │ │ │ │ ├── DINode.cs
│ │ │ │ │ │ ├── DINodeArray.cs
│ │ │ │ │ │ ├── DIObjCProperty.cs
│ │ │ │ │ │ ├── DIScope.cs
│ │ │ │ │ │ ├── DISubProgram.cs
│ │ │ │ │ │ ├── DISubRange.cs
│ │ │ │ │ │ ├── DISubroutineType.cs
│ │ │ │ │ │ ├── DITemplateParameter.cs
│ │ │ │ │ │ ├── DITemplateTypeParameter.cs
│ │ │ │ │ │ ├── DITemplateValueParameter.cs
│ │ │ │ │ │ ├── DIType.cs
│ │ │ │ │ │ ├── DITypeArray.cs
│ │ │ │ │ │ ├── DIVariable.cs
│ │ │ │ │ │ ├── DebugArrayType.cs
│ │ │ │ │ │ ├── DebugBasicType.cs
│ │ │ │ │ │ ├── DebugFunctionType.cs
│ │ │ │ │ │ ├── DebugInfoBuilder.cs
│ │ │ │ │ │ ├── DebugMemberInfo.cs
│ │ │ │ │ │ ├── DebugPointerType.cs
│ │ │ │ │ │ ├── DebugStructType.cs
│ │ │ │ │ │ ├── DebugType.cs
│ │ │ │ │ │ ├── DwarfEnumerations.cs
│ │ │ │ │ │ ├── GenericDINode.cs
│ │ │ │ │ │ └── MDNodeOperandList.cs
│ │ │ │ │ ├── Enumerations.cs
│ │ │ │ │ ├── GlobalPassRegistry.cs
│ │ │ │ │ ├── IExtensiblePropertyContainer.cs
│ │ │ │ │ ├── Instructions/
│ │ │ │ │ │ ├── AddressSpaceCast.cs
│ │ │ │ │ │ ├── Alloca.cs
│ │ │ │ │ │ ├── AtomicCmpXchg.cs
│ │ │ │ │ │ ├── AtomicRMW.cs
│ │ │ │ │ │ ├── BinaryOperator.cs
│ │ │ │ │ │ ├── BitCast.cs
│ │ │ │ │ │ ├── Branch.cs
│ │ │ │ │ │ ├── Call.cs
│ │ │ │ │ │ ├── Cast.cs
│ │ │ │ │ │ ├── CatchPad.cs
│ │ │ │ │ │ ├── CatchReturn.cs
│ │ │ │ │ │ ├── CatchSwitch.cs
│ │ │ │ │ │ ├── CleanupPad.cs
│ │ │ │ │ │ ├── CleanupReturn.cs
│ │ │ │ │ │ ├── Cmp.cs
│ │ │ │ │ │ ├── DebugDeclare.cs
│ │ │ │ │ │ ├── DebugInfoIntrinsic.cs
│ │ │ │ │ │ ├── ExtractElement.cs
│ │ │ │ │ │ ├── ExtractValue.cs
│ │ │ │ │ │ ├── FCmp.cs
│ │ │ │ │ │ ├── FPExt.cs
│ │ │ │ │ │ ├── FPToSI.cs
│ │ │ │ │ │ ├── FPToUI.cs
│ │ │ │ │ │ ├── FPTrunc.cs
│ │ │ │ │ │ ├── Fence.cs
│ │ │ │ │ │ ├── FuncletPad.cs
│ │ │ │ │ │ ├── GetElementPtr.cs
│ │ │ │ │ │ ├── IndirectBranch.cs
│ │ │ │ │ │ ├── InsertElement.cs
│ │ │ │ │ │ ├── InsertValue.cs
│ │ │ │ │ │ ├── Instruction.cs
│ │ │ │ │ │ ├── InstructionBuilder.cs
│ │ │ │ │ │ ├── IntCmp.cs
│ │ │ │ │ │ ├── IntToPointer.cs
│ │ │ │ │ │ ├── Intrinsic.cs
│ │ │ │ │ │ ├── Invoke.cs
│ │ │ │ │ │ ├── LandingPad.cs
│ │ │ │ │ │ ├── Load.cs
│ │ │ │ │ │ ├── MemCpy.cs
│ │ │ │ │ │ ├── MemIntrinsic.cs
│ │ │ │ │ │ ├── MemMove.cs
│ │ │ │ │ │ ├── MemSet.cs
│ │ │ │ │ │ ├── PhiNode.cs
│ │ │ │ │ │ ├── PointerToInt.cs
│ │ │ │ │ │ ├── Resume.cs
│ │ │ │ │ │ ├── Return.cs
│ │ │ │ │ │ ├── SIToFP.cs
│ │ │ │ │ │ ├── Select.cs
│ │ │ │ │ │ ├── ShuffleVector.cs
│ │ │ │ │ │ ├── SignExtend.cs
│ │ │ │ │ │ ├── Store.cs
│ │ │ │ │ │ ├── Switch.cs
│ │ │ │ │ │ ├── Terminator.cs
│ │ │ │ │ │ ├── Trunc.cs
│ │ │ │ │ │ ├── UIToFP.cs
│ │ │ │ │ │ ├── UnaryInstruction.cs
│ │ │ │ │ │ ├── Unreachable.cs
│ │ │ │ │ │ ├── UserOp1.cs
│ │ │ │ │ │ ├── UserOp2.cs
│ │ │ │ │ │ ├── VAArg.cs
│ │ │ │ │ │ └── ZeroExtend.cs
│ │ │ │ │ ├── InternalCodeGeneratorException.cs
│ │ │ │ │ ├── LLVM/
│ │ │ │ │ │ ├── Generated.cs
│ │ │ │ │ │ ├── GeneratedExtensions.cs
│ │ │ │ │ │ ├── LLVMNative.cs
│ │ │ │ │ │ └── LlvmHandles.cs
│ │ │ │ │ ├── Llvm.NET.csproj
│ │ │ │ │ ├── Llvm.NET.ruleset
│ │ │ │ │ ├── MemoryBuffer.cs
│ │ │ │ │ ├── Metadata/
│ │ │ │ │ │ ├── ConstantAsMetadata.cs
│ │ │ │ │ │ ├── LocalAsMetadata.cs
│ │ │ │ │ │ ├── MDNode.cs
│ │ │ │ │ │ ├── MDOperand.cs
│ │ │ │ │ │ ├── MDString.cs
│ │ │ │ │ │ ├── MDTuple.cs
│ │ │ │ │ │ ├── Metadata.cs
│ │ │ │ │ │ ├── MetadataAsValue.cs
│ │ │ │ │ │ ├── NamedMDNode.cs
│ │ │ │ │ │ └── ValueAsMetadata.cs
│ │ │ │ │ ├── Module.cs
│ │ │ │ │ ├── NativeMethods.cs
│ │ │ │ │ ├── PassManagerBuilder.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── ScalarEnumerable.cs
│ │ │ │ │ ├── StaticState.cs
│ │ │ │ │ ├── Target.cs
│ │ │ │ │ ├── TargetMachine.cs
│ │ │ │ │ ├── Types/
│ │ │ │ │ │ ├── ArrayType.cs
│ │ │ │ │ │ ├── FunctionType.cs
│ │ │ │ │ │ ├── ITypeRef.cs
│ │ │ │ │ │ ├── PointerType.cs
│ │ │ │ │ │ ├── SequenceType.cs
│ │ │ │ │ │ ├── StructType.cs
│ │ │ │ │ │ ├── TypeRef.cs
│ │ │ │ │ │ └── VectorType.cs
│ │ │ │ │ └── Values/
│ │ │ │ │ ├── Argument.cs
│ │ │ │ │ ├── AttributeBuilder.cs
│ │ │ │ │ ├── AttributeKindExtensions.cs
│ │ │ │ │ ├── AttributeSet.cs
│ │ │ │ │ ├── AttributeSetContainer.cs
│ │ │ │ │ ├── AttributeValue.cs
│ │ │ │ │ ├── BasicBlock.cs
│ │ │ │ │ ├── BlockAddress.cs
│ │ │ │ │ ├── ConstPointerNull.cs
│ │ │ │ │ ├── Constant.cs
│ │ │ │ │ ├── ConstantAggregateZero.cs
│ │ │ │ │ ├── ConstantArray.cs
│ │ │ │ │ ├── ConstantDataArray.cs
│ │ │ │ │ ├── ConstantDataSequential.cs
│ │ │ │ │ ├── ConstantDataVector.cs
│ │ │ │ │ ├── ConstantExpression.cs
│ │ │ │ │ ├── ConstantFP.cs
│ │ │ │ │ ├── ConstantInt.cs
│ │ │ │ │ ├── ConstantStruct.cs
│ │ │ │ │ ├── ConstantTokenNone.cs
│ │ │ │ │ ├── ConstantVector.cs
│ │ │ │ │ ├── Function.cs
│ │ │ │ │ ├── FunctionParameterList.cs
│ │ │ │ │ ├── GlobalAlias.cs
│ │ │ │ │ ├── GlobalObject.cs
│ │ │ │ │ ├── GlobalValue.cs
│ │ │ │ │ ├── GlobalVariable.cs
│ │ │ │ │ ├── IAttributeSetContainer.cs
│ │ │ │ │ ├── InlineAsm.cs
│ │ │ │ │ ├── UndefValue.cs
│ │ │ │ │ ├── Use.cs
│ │ │ │ │ ├── User.cs
│ │ │ │ │ ├── UserOperandList.cs
│ │ │ │ │ └── Value.cs
│ │ │ │ └── Llvm.NET.sln
│ │ │ ├── MetaData/
│ │ │ │ ├── Importer/
│ │ │ │ │ ├── AbstractMetaDataException.cs
│ │ │ │ │ ├── ArrayReader.cs
│ │ │ │ │ ├── ArrayWriter.cs
│ │ │ │ │ ├── EHClause.cs
│ │ │ │ │ ├── IllegalMetaDataFormatException.cs
│ │ │ │ │ ├── Importer.csproj
│ │ │ │ │ ├── Instruction.cs
│ │ │ │ │ ├── LogWriter.cs
│ │ │ │ │ ├── MarshalSpec.cs
│ │ │ │ │ ├── MetaData.cs
│ │ │ │ │ ├── MetaDataAssembly.cs
│ │ │ │ │ ├── MetaDataAssemblyRef.cs
│ │ │ │ │ ├── MetaDataClassLayout.cs
│ │ │ │ │ ├── MetaDataConstant.cs
│ │ │ │ │ ├── MetaDataCustomAttribute.cs
│ │ │ │ │ ├── MetaDataDeclSecurity.cs
│ │ │ │ │ ├── MetaDataDumper.cs
│ │ │ │ │ ├── MetaDataEvent.cs
│ │ │ │ │ ├── MetaDataField.cs
│ │ │ │ │ ├── MetaDataFieldLayout.cs
│ │ │ │ │ ├── MetaDataFieldMarshal.cs
│ │ │ │ │ ├── MetaDataFieldRVA.cs
│ │ │ │ │ ├── MetaDataFile.cs
│ │ │ │ │ ├── MetaDataGenericParam.cs
│ │ │ │ │ ├── MetaDataImplMap.cs
│ │ │ │ │ ├── MetaDataManifestResource.cs
│ │ │ │ │ ├── MetaDataMemberRef.cs
│ │ │ │ │ ├── MetaDataMethod.cs
│ │ │ │ │ ├── MetaDataMethodImpl.cs
│ │ │ │ │ ├── MetaDataMethodSemantics.cs
│ │ │ │ │ ├── MetaDataMethodSpec.cs
│ │ │ │ │ ├── MetaDataMethod_Code.cs
│ │ │ │ │ ├── MetaDataModule.cs
│ │ │ │ │ ├── MetaDataModuleRef.cs
│ │ │ │ │ ├── MetaDataNormalizationContext.cs
│ │ │ │ │ ├── MetaDataObject.cs
│ │ │ │ │ ├── MetaDataParam.cs
│ │ │ │ │ ├── MetaDataProperty.cs
│ │ │ │ │ ├── MetaDataResolver.cs
│ │ │ │ │ ├── MetaDataStandAloneSig.cs
│ │ │ │ │ ├── MetaDataTypeDefinition.cs
│ │ │ │ │ ├── MetaDataTypeReference.cs
│ │ │ │ │ ├── MetaDataTypeSpec.cs
│ │ │ │ │ ├── PDBInfo/
│ │ │ │ │ │ ├── BitSet.cs
│ │ │ │ │ │ ├── CvInfo.cs
│ │ │ │ │ │ ├── DataStream.cs
│ │ │ │ │ │ ├── DbiHeader.cs
│ │ │ │ │ │ ├── DbiModuleInfo.cs
│ │ │ │ │ │ ├── DbiSecCon.cs
│ │ │ │ │ │ ├── MsfDirectory.cs
│ │ │ │ │ │ ├── PdbException.cs
│ │ │ │ │ │ ├── PdbFile.cs
│ │ │ │ │ │ ├── PdbFileHeader.cs
│ │ │ │ │ │ ├── PdbFunction.cs
│ │ │ │ │ │ ├── PdbLine.cs
│ │ │ │ │ │ ├── PdbLines.cs
│ │ │ │ │ │ ├── PdbReader.cs
│ │ │ │ │ │ ├── PdbScope.cs
│ │ │ │ │ │ ├── PdbSlot.cs
│ │ │ │ │ │ ├── PdbSource.cs
│ │ │ │ │ │ ├── PdbStream.cs
│ │ │ │ │ │ └── PdbWriter.cs
│ │ │ │ │ ├── PELoader.cs
│ │ │ │ │ ├── Parser.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Signature.cs
│ │ │ │ │ ├── SignatureField.cs
│ │ │ │ │ ├── SignatureLocalVar.cs
│ │ │ │ │ ├── SignatureMethod.cs
│ │ │ │ │ ├── SignatureMethodSpec.cs
│ │ │ │ │ ├── SignatureProperty.cs
│ │ │ │ │ ├── SignatureTypeSpec.cs
│ │ │ │ │ ├── SilentCompilationAbortException.cs
│ │ │ │ │ └── UnresolvedExternalReferenceException.cs
│ │ │ │ ├── MetaData.UnitTest/
│ │ │ │ │ ├── Bench.cs
│ │ │ │ │ ├── CompressionTester.cs
│ │ │ │ │ ├── MetaData.UnitTest.csproj
│ │ │ │ │ ├── MetaDataParserTester.cs
│ │ │ │ │ ├── MetaDataResolverTester.cs
│ │ │ │ │ ├── PDBFileTester.cs
│ │ │ │ │ ├── PELoaderTester.cs
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── Normalized/
│ │ │ │ ├── EHClause.cs
│ │ │ │ ├── Instruction.cs
│ │ │ │ ├── MarshalSpec.cs
│ │ │ │ ├── MetaDataAssembly.cs
│ │ │ │ ├── MetaDataBits.cs
│ │ │ │ ├── MetaDataClassLayout.cs
│ │ │ │ ├── MetaDataConstant.cs
│ │ │ │ ├── MetaDataCustomAttribute.cs
│ │ │ │ ├── MetaDataDeclSecurity.cs
│ │ │ │ ├── MetaDataEvent.cs
│ │ │ │ ├── MetaDataField.cs
│ │ │ │ ├── MetaDataFieldAbstract.cs
│ │ │ │ ├── MetaDataFieldLayout.cs
│ │ │ │ ├── MetaDataFieldMarshal.cs
│ │ │ │ ├── MetaDataFieldRVA.cs
│ │ │ │ ├── MetaDataFieldWithContext.cs
│ │ │ │ ├── MetaDataFile.cs
│ │ │ │ ├── MetaDataGenericMethodParam.cs
│ │ │ │ ├── MetaDataGenericParam.cs
│ │ │ │ ├── MetaDataGenericTypeParam.cs
│ │ │ │ ├── MetaDataImplMap.cs
│ │ │ │ ├── MetaDataInterfaces.cs
│ │ │ │ ├── MetaDataManifestResource.cs
│ │ │ │ ├── MetaDataMethod.cs
│ │ │ │ ├── MetaDataMethodAbstract.cs
│ │ │ │ ├── MetaDataMethodBase.cs
│ │ │ │ ├── MetaDataMethodGeneric.cs
│ │ │ │ ├── MetaDataMethodGenericInstantiation.cs
│ │ │ │ ├── MetaDataMethodImpl.cs
│ │ │ │ ├── MetaDataMethodSemantics.cs
│ │ │ │ ├── MetaDataMethodWithContext.cs
│ │ │ │ ├── MetaDataModule.cs
│ │ │ │ ├── MetaDataObject.cs
│ │ │ │ ├── MetaDataParam.cs
│ │ │ │ ├── MetaDataProperty.cs
│ │ │ │ ├── MetaDataSignature.cs
│ │ │ │ ├── MetaDataTypeDefinition.cs
│ │ │ │ ├── MetaDataTypeDefinitionAbstract.cs
│ │ │ │ ├── MetaDataTypeDefinitionArray.cs
│ │ │ │ ├── MetaDataTypeDefinitionArrayMulti.cs
│ │ │ │ ├── MetaDataTypeDefinitionArraySz.cs
│ │ │ │ ├── MetaDataTypeDefinitionBase.cs
│ │ │ │ ├── MetaDataTypeDefinitionByRef.cs
│ │ │ │ ├── MetaDataTypeDefinitionDelayed.cs
│ │ │ │ ├── MetaDataTypeDefinitionGeneric.cs
│ │ │ │ ├── MetaDataTypeDefinitionGenericInstantiation.cs
│ │ │ │ ├── MetaDataTypeDefinitionPartiallyDelayedMethodParameter.cs
│ │ │ │ ├── MetaDataTypeDefinitionPartiallyDelayedTypeParameter.cs
│ │ │ │ ├── MetaDataVersion.cs
│ │ │ │ ├── Normalized.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── SignatureField.cs
│ │ │ │ ├── SignatureMethod.cs
│ │ │ │ └── SignatureType.cs
│ │ │ └── TargetModels/
│ │ │ ├── ArmProcessor/
│ │ │ │ ├── ARM/
│ │ │ │ │ ├── EncodingDefinition_ARM.cs
│ │ │ │ │ └── EncodingDefinition_VFP_ARM.cs
│ │ │ │ ├── ArmProcessor.csproj
│ │ │ │ ├── CurrentInstructionSetEncoding.cs
│ │ │ │ ├── EncodingDefinition.cs
│ │ │ │ ├── EncodingDefinition_VFP.cs
│ │ │ │ ├── InstructionSet.cs
│ │ │ │ ├── InstructionSetVersion.cs
│ │ │ │ ├── InstructionSet_VFP.cs
│ │ │ │ └── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── ProductConfiguration/
│ │ │ │ ├── Abstractions/
│ │ │ │ │ ├── ARM/
│ │ │ │ │ │ ├── ArchitectureVersions/
│ │ │ │ │ │ │ ├── ArmV4.cs
│ │ │ │ │ │ │ ├── ArmV4_Optimizations.cs
│ │ │ │ │ │ │ ├── ArmV5.cs
│ │ │ │ │ │ │ ├── ArmV5_VFP.cs
│ │ │ │ │ │ │ ├── ArmV5_VFP_CollectRegisterAllocationConstraints.cs
│ │ │ │ │ │ │ └── ArmV5_VFP_Emulation.cs
│ │ │ │ │ │ ├── ArmCallingConvention.cs
│ │ │ │ │ │ ├── ArmPlatform.cs
│ │ │ │ │ │ ├── ArmPlatform_CompilationState.cs
│ │ │ │ │ │ ├── ArmPlatform_CompilationState_CodeMap.cs
│ │ │ │ │ │ ├── ArmPlatform_CompilationState_EmitCode.cs
│ │ │ │ │ │ ├── ArmPlatform_CompilationState_Encoder.cs
│ │ │ │ │ │ ├── ArmPlatform_CompilationState_Encoder_VFP.cs
│ │ │ │ │ │ ├── ArmPlatform_EmitPrologueEpilogue.cs
│ │ │ │ │ │ ├── ArmPlatform_Handlers_ExpandAggregateTypes.cs.cs
│ │ │ │ │ │ ├── ArmPlatform_Handlers_HighLevel.cs
│ │ │ │ │ │ ├── ArmPlatform_OperatorConstraints.cs
│ │ │ │ │ │ ├── ArmPlatform_Optimizations.cs
│ │ │ │ │ │ ├── ArmPlatform_PrepareForRegisterAllocation.cs
│ │ │ │ │ │ ├── ArmPlatform_RegisterAllocation.cs
│ │ │ │ │ │ ├── ArmPlatform_SplitComplexOperators.cs
│ │ │ │ │ │ ├── ImageAnnotations/
│ │ │ │ │ │ │ ├── ArmCodeRelocation_Branch.cs
│ │ │ │ │ │ │ ├── ArmCodeRelocation_ExternMethod.cs
│ │ │ │ │ │ │ ├── ArmCodeRelocation_FLD.cs
│ │ │ │ │ │ │ ├── ArmCodeRelocation_LDR.cs
│ │ │ │ │ │ │ └── ArmCodeRelocation_MOV.cs
│ │ │ │ │ │ └── Operators/
│ │ │ │ │ │ ├── BinaryOperatorWithShift.cs
│ │ │ │ │ │ ├── BreakpointOperator.cs
│ │ │ │ │ │ ├── GetStatusRegisterOperator.cs
│ │ │ │ │ │ ├── IndirectOperatorWithIndexUpdate.cs
│ │ │ │ │ │ ├── LoadIndirectOperatorWithIndexUpdate.cs
│ │ │ │ │ │ ├── MoveFloatingPointRegistersOperator.cs
│ │ │ │ │ │ ├── MoveFromCoprocessor.cs
│ │ │ │ │ │ ├── MoveIntegerRegistersOperator.cs
│ │ │ │ │ │ ├── MoveStackPointerOperator.cs
│ │ │ │ │ │ ├── MoveToCoprocessor.cs
│ │ │ │ │ │ ├── SetStatusRegisterOperator.cs
│ │ │ │ │ │ ├── StoreIndirectOperatorWithIndexUpdate.cs
│ │ │ │ │ │ ├── VectorHack_Base.cs
│ │ │ │ │ │ ├── VectorHack_Cleanup.cs
│ │ │ │ │ │ ├── VectorHack_Finalize.cs
│ │ │ │ │ │ ├── VectorHack_Initialize.cs
│ │ │ │ │ │ ├── VectorHack_LoadData.cs
│ │ │ │ │ │ ├── VectorHack_MultiplyAndAccumulate.cs
│ │ │ │ │ │ └── VectorHack_Prepare.cs
│ │ │ │ │ └── LLVMforZelig/
│ │ │ │ │ ├── LlvmForArmV6M.cs
│ │ │ │ │ ├── LlvmForArmV7M.cs
│ │ │ │ │ ├── LlvmForArmV7MCallingConvention.cs
│ │ │ │ │ ├── LlvmForArmV7MCompilationState.cs
│ │ │ │ │ ├── LlvmForArmV7MCompilationState_BasicBlocks.cs
│ │ │ │ │ ├── LlvmForArmV7M_VFP.cs
│ │ │ │ │ ├── LlvmForWin32.cs
│ │ │ │ │ └── ValueCache.cs
│ │ │ │ ├── Loaders.Designer.cs
│ │ │ │ ├── Loaders.resx
│ │ │ │ ├── Manager.cs
│ │ │ │ ├── Models/
│ │ │ │ │ ├── Displays.cs
│ │ │ │ │ ├── Engines.cs
│ │ │ │ │ ├── LegacyProducts.cs
│ │ │ │ │ ├── Memories.cs
│ │ │ │ │ └── Processors.cs
│ │ │ │ ├── NandFlashJTagLoaderCategory.cs
│ │ │ │ ├── NorFlashJTagLoaderCategory.cs
│ │ │ │ ├── ProductConfiguration.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── RamJTagLoaderCategory.cs
│ │ │ │ ├── Resources/
│ │ │ │ │ ├── Microsoft.NohauLPC3180Loader.hex
│ │ │ │ │ ├── Microsoft.VoxSoloFormFactorLoader.hex
│ │ │ │ │ └── Microsoft.iMote2Loader.hex
│ │ │ │ └── XScaleNorFlashJTagLoaderCategory.cs
│ │ │ └── Win32EmuProcessor/
│ │ │ ├── InstructionSetVersion.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ └── Win32Processor.csproj
│ │ ├── DebugTime/
│ │ │ ├── ArmProcessorEmulation/
│ │ │ │ ├── ArmProcessorEmulation.csproj
│ │ │ │ ├── Forms/
│ │ │ │ │ ├── BaseDebuggerForm.Designer.cs
│ │ │ │ │ ├── BaseDebuggerForm.cs
│ │ │ │ │ ├── BaseDebuggerForm.resx
│ │ │ │ │ └── HostingSite.cs
│ │ │ │ ├── Hosting/
│ │ │ │ │ ├── AbstractEngine.cs
│ │ │ │ │ ├── AbstractEngineException.cs
│ │ │ │ │ ├── AbstractHardwarePlugIn.cs
│ │ │ │ │ ├── AbstractHost.cs
│ │ │ │ │ ├── AbstractPlugIn.cs
│ │ │ │ │ ├── AbstractUIPlugIn.cs
│ │ │ │ │ ├── BinaryBlob.cs
│ │ │ │ │ ├── Breakpoint.cs
│ │ │ │ │ ├── CodeCoverage.cs
│ │ │ │ │ ├── DebugCommunicationChannel.cs
│ │ │ │ │ ├── DeviceClockTicksTracking.cs
│ │ │ │ │ ├── ExtraDeploymentSteps.cs
│ │ │ │ │ ├── HalButtons.cs
│ │ │ │ │ ├── HalEvents.cs
│ │ │ │ │ ├── IAsynchronousSerialPort.cs
│ │ │ │ │ ├── ISynchronousSerialInterfaceBus.cs
│ │ │ │ │ ├── ISynchronousSerialInterfaceController.cs
│ │ │ │ │ ├── Interop.cs
│ │ │ │ │ ├── JTagConnector.cs
│ │ │ │ │ ├── JTagCustomer.cs
│ │ │ │ │ ├── MemoryProvider.cs
│ │ │ │ │ ├── MonitorExecution.cs
│ │ │ │ │ ├── OutputSink.cs
│ │ │ │ │ ├── ProcessorControl.cs
│ │ │ │ │ ├── ProcessorPerformance.cs
│ │ │ │ │ ├── ProcessorStatus.cs
│ │ │ │ │ ├── SED15E0Sink.cs
│ │ │ │ │ ├── SimulatedDeviceClockTicksTracking.cs
│ │ │ │ │ ├── SimulatorControl.cs
│ │ │ │ │ └── TypeSystem.cs
│ │ │ │ ├── Models/
│ │ │ │ │ ├── Chipset/
│ │ │ │ │ │ ├── MM9691LP.cs
│ │ │ │ │ │ └── PXA27x.cs
│ │ │ │ │ ├── Display/
│ │ │ │ │ │ └── SED15E0.cs
│ │ │ │ │ ├── FlashMemory/
│ │ │ │ │ │ ├── S29WS064.cs
│ │ │ │ │ │ └── S29WS128N.cs
│ │ │ │ │ └── VoxSoloFormFactor/
│ │ │ │ │ └── Interops.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── SRecordParser.cs
│ │ │ │ ├── Simulator.cs
│ │ │ │ ├── SimulatorCore.cs
│ │ │ │ └── SymDef.cs
│ │ │ ├── Debugger/
│ │ │ │ ├── Debugger.csproj
│ │ │ │ ├── Execution/
│ │ │ │ │ ├── DebugGarbageColllection.cs
│ │ │ │ │ ├── ImageInformation.cs
│ │ │ │ │ ├── InteropHelper.cs
│ │ │ │ │ ├── MemoryDelta.cs
│ │ │ │ │ ├── PerformanceCounter.cs
│ │ │ │ │ ├── ProcessorHost.cs
│ │ │ │ │ ├── Profiler.cs
│ │ │ │ │ ├── RegisterContext.cs
│ │ │ │ │ ├── Session.cs
│ │ │ │ │ ├── StackFrame.cs
│ │ │ │ │ ├── ThreadStatus.cs
│ │ │ │ │ ├── ValueHandles/
│ │ │ │ │ │ ├── AbstractValueHandle.cs
│ │ │ │ │ │ ├── BitFieldValueHandle.cs
│ │ │ │ │ │ ├── CompoundValueHandle.cs
│ │ │ │ │ │ ├── MemoryValueHandle.cs
│ │ │ │ │ │ ├── RegisterValueHandle.cs
│ │ │ │ │ │ └── SlicedValueHandle.cs
│ │ │ │ │ └── WatchHelper.cs
│ │ │ │ ├── Forms/
│ │ │ │ │ ├── DebuggerMainForm.Actions.cs
│ │ │ │ │ ├── DebuggerMainForm.Designer.cs
│ │ │ │ │ ├── DebuggerMainForm.Worker.cs
│ │ │ │ │ ├── DebuggerMainForm.cs
│ │ │ │ │ ├── DebuggerMainForm.resx
│ │ │ │ │ ├── DisplayForm.Designer.cs
│ │ │ │ │ ├── DisplayForm.cs
│ │ │ │ │ ├── DisplayForm.resx
│ │ │ │ │ ├── EnvironmentForm.Designer.cs
│ │ │ │ │ ├── EnvironmentForm.cs
│ │ │ │ │ ├── EnvironmentForm.resx
│ │ │ │ │ ├── IMainForm.cs
│ │ │ │ │ ├── InputForm.Designer.cs
│ │ │ │ │ ├── InputForm.cs
│ │ │ │ │ ├── InputForm.resx
│ │ │ │ │ ├── OutputForm.Designer.cs
│ │ │ │ │ ├── OutputForm.cs
│ │ │ │ │ ├── OutputForm.resx
│ │ │ │ │ ├── ProfilerMainForm.Designer.cs
│ │ │ │ │ ├── ProfilerMainForm.cs
│ │ │ │ │ ├── ProfilerMainForm.resx
│ │ │ │ │ ├── SessionManager.Designer.cs
│ │ │ │ │ ├── SessionManager.cs
│ │ │ │ │ └── SessionManager.resx
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ │ ├── Resources.Designer.cs
│ │ │ │ │ ├── Resources.resx
│ │ │ │ │ ├── Settings.Designer.cs
│ │ │ │ │ └── Settings.settings
│ │ │ │ ├── SoloDebugOverDccUI_HW.DebuggerConfig
│ │ │ │ ├── SoloOverDccUI.DebuggerConfig
│ │ │ │ ├── SoloOverDccUI_HW.DebuggerConfig
│ │ │ │ ├── SoloOverSerialUI_HW.DebuggerConfig
│ │ │ │ ├── SoloUI.DebuggerConfig
│ │ │ │ ├── UserControls/
│ │ │ │ │ ├── BreakpointsView.Designer.cs
│ │ │ │ │ ├── BreakpointsView.cs
│ │ │ │ │ ├── BreakpointsView.resx
│ │ │ │ │ ├── CodeView.Designer.cs
│ │ │ │ │ ├── CodeView.Parsers.cs
│ │ │ │ │ ├── CodeView.cs
│ │ │ │ │ ├── CodeView.resx
│ │ │ │ │ ├── LocalsView.Designer.cs
│ │ │ │ │ ├── LocalsView.cs
│ │ │ │ │ ├── LocalsView.resx
│ │ │ │ │ ├── MemoryView.Designer.cs
│ │ │ │ │ ├── MemoryView.cs
│ │ │ │ │ ├── MemoryView.resx
│ │ │ │ │ ├── RegistersView.Designer.cs
│ │ │ │ │ ├── RegistersView.cs
│ │ │ │ │ ├── RegistersView.resx
│ │ │ │ │ ├── StackTraceView.Designer.cs
│ │ │ │ │ ├── StackTraceView.cs
│ │ │ │ │ ├── StackTraceView.resx
│ │ │ │ │ ├── ThreadsView.Designer.cs
│ │ │ │ │ ├── ThreadsView.cs
│ │ │ │ │ ├── ThreadsView.resx
│ │ │ │ │ ├── TreeBasedGridView.Designer.cs
│ │ │ │ │ ├── TreeBasedGridView.cs
│ │ │ │ │ └── TreeBasedGridView.resx
│ │ │ │ ├── VisualTree/
│ │ │ │ │ ├── GraphicsContext.cs
│ │ │ │ │ ├── VisualEffects/
│ │ │ │ │ │ ├── InlineDisassembly.cs
│ │ │ │ │ │ ├── SourceCodeHighlight.cs
│ │ │ │ │ │ └── VisualEffect.cs
│ │ │ │ │ ├── VisualItems/
│ │ │ │ │ │ ├── AddressVisualItem.cs
│ │ │ │ │ │ ├── BackgroundVisualItem.cs
│ │ │ │ │ │ ├── BaseTextVisualItem.cs
│ │ │ │ │ │ ├── ByteVisualItem.cs
│ │ │ │ │ │ ├── CharsVisualItem.cs
│ │ │ │ │ │ ├── ContainerVisualItem.cs
│ │ │ │ │ │ ├── IconVisualItem.cs
│ │ │ │ │ │ ├── ShortVisualItem.cs
│ │ │ │ │ │ ├── TextVisualItem.cs
│ │ │ │ │ │ ├── VisualItem.cs
│ │ │ │ │ │ └── WordVisualItem.cs
│ │ │ │ │ └── VisualTreeInfo.cs
│ │ │ │ ├── app.config
│ │ │ │ ├── test.DebuggerConfig
│ │ │ │ └── test.ZeligDebugSession
│ │ │ ├── Elf/
│ │ │ │ ├── ElfLib/
│ │ │ │ │ ├── DebugInfoEntry.cs
│ │ │ │ │ ├── ElfObject.cs
│ │ │ │ │ ├── ElfObject_Descriptors.cs
│ │ │ │ │ ├── ElfObject_Factory.cs
│ │ │ │ │ ├── ElfObject_FileUtil.cs
│ │ │ │ │ ├── ElfObject_HelperTypes.cs
│ │ │ │ │ ├── ElfSection.cs
│ │ │ │ │ ├── ElfSegment.cs
│ │ │ │ │ ├── Elflib.csproj
│ │ │ │ │ ├── OutputFormatter.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── RelocationEntry.cs
│ │ │ │ │ ├── RelocationSection.cs
│ │ │ │ │ ├── SectionReference.cs
│ │ │ │ │ ├── StringTable.cs
│ │ │ │ │ ├── Symbol.cs
│ │ │ │ │ └── SymbolTable.cs
│ │ │ │ └── ReadElf/
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── ReadElf.csproj
│ │ │ └── Loader/
│ │ │ ├── Loader.Designer.cs
│ │ │ ├── Loader.cs
│ │ │ ├── Loader.csproj
│ │ │ ├── Loader.resx
│ │ │ ├── Program.cs
│ │ │ └── Properties/
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── FileSystemTest/
│ │ │ ├── Directory/
│ │ │ │ ├── CreateDirectory.cs
│ │ │ │ ├── DI_Constructor.cs
│ │ │ │ ├── Delete.cs
│ │ │ │ ├── DirectoryInfoTests.cs
│ │ │ │ ├── DirectoryTests.cs
│ │ │ │ ├── Exists.cs
│ │ │ │ ├── GetDirectories.cs
│ │ │ │ ├── GetFiles.cs
│ │ │ │ ├── GetSetCurrentDirectory.cs
│ │ │ │ └── Move.cs
│ │ │ ├── File/
│ │ │ │ ├── Copy.cs
│ │ │ │ ├── Create.cs
│ │ │ │ ├── Delete.cs
│ │ │ │ ├── Exists.cs
│ │ │ │ ├── FileInfoTests.cs
│ │ │ │ ├── FileTests.cs
│ │ │ │ ├── GetSetAttributes.cs
│ │ │ │ ├── OpenRead.cs
│ │ │ │ ├── OpenWrite.cs
│ │ │ │ ├── Open_FM.cs
│ │ │ │ ├── Open_FM_FA.cs
│ │ │ │ ├── Open_FM_FA_FS.cs
│ │ │ │ └── ReadAllBytes.cs
│ │ │ ├── FileStream/
│ │ │ │ ├── CanRead.cs
│ │ │ │ ├── CanSeek.cs
│ │ │ │ ├── CanWrite.cs
│ │ │ │ ├── Constructors_FileAccess.cs
│ │ │ │ ├── Constructors_FileMode.cs
│ │ │ │ ├── Constructors_FileShare.cs
│ │ │ │ ├── FileStreamHelper.cs
│ │ │ │ ├── FileStreamTests.cs
│ │ │ │ ├── Flush.cs
│ │ │ │ ├── PropertyTests.cs
│ │ │ │ ├── Read.cs
│ │ │ │ ├── Seek.cs
│ │ │ │ └── Write.cs
│ │ │ ├── FileSystemTest.csproj
│ │ │ ├── IOTestsHelper.cs
│ │ │ ├── MemoryStream/
│ │ │ │ ├── CanRead.cs
│ │ │ │ ├── CanSeek.cs
│ │ │ │ ├── CanWrite.cs
│ │ │ │ ├── Close.cs
│ │ │ │ ├── Flush.cs
│ │ │ │ ├── Length.cs
│ │ │ │ ├── MemoryStreamHelper.cs
│ │ │ │ ├── MemoryStream_Ctor.cs
│ │ │ │ ├── Position.cs
│ │ │ │ ├── Read.cs
│ │ │ │ ├── ReadByte.cs
│ │ │ │ ├── Seek.cs
│ │ │ │ ├── SetLength.cs
│ │ │ │ ├── ToArray.cs
│ │ │ │ ├── Write.cs
│ │ │ │ ├── WriteByte.cs
│ │ │ │ └── WriteTo.cs
│ │ │ ├── Path/
│ │ │ │ ├── ChangeExtension.cs
│ │ │ │ ├── Combine.cs
│ │ │ │ ├── GetDirectoryName.cs
│ │ │ │ ├── GetExtension.cs
│ │ │ │ ├── GetFileName.cs
│ │ │ │ ├── GetFileNameWithoutExtension.cs
│ │ │ │ ├── GetFullPath.cs
│ │ │ │ ├── GetPathRoot.cs
│ │ │ │ ├── HasExtension.cs
│ │ │ │ ├── IsPathRooted.cs
│ │ │ │ └── PathTests.cs
│ │ │ ├── Program.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ └── VolumeLabelTests.cs
│ │ ├── RunTime/
│ │ │ ├── DeviceModels/
│ │ │ │ ├── CortexM0OnCMSIS-Core/
│ │ │ │ │ ├── CortexM0OnCMSIS-Core.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── CortexM0OnMBED/
│ │ │ │ │ ├── CortexM0OnMBED.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── AdcChannel.cs
│ │ │ │ │ │ │ ├── GpioPin.cs
│ │ │ │ │ │ │ ├── I2cChannel.cs
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── PwmChannel.cs
│ │ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ │ ├── SpiChannel.cs
│ │ │ │ │ │ │ ├── StandardSerialPort.cs
│ │ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ │ ├── AdcProvider.cs
│ │ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ │ ├── PwmProvider.cs
│ │ │ │ │ │ │ ├── SocketProvider.cs
│ │ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── SchedulerTimeImpl.cs
│ │ │ │ │ ├── SchedulerTimeSpanImpl.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── CortexM3OnCMSIS-Core/
│ │ │ │ │ ├── CortexM3OnCMSIS-Core.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── CortexM3OnMBED/
│ │ │ │ │ ├── CortexM3OnMBED.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ │ ├── AdcProvider.cs
│ │ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ │ ├── NetworkInterfaceProvider.cs
│ │ │ │ │ │ │ ├── PwmProvider.cs
│ │ │ │ │ │ │ ├── SocketProvider.cs
│ │ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── CortexM4OnCMSIS-Core/
│ │ │ │ │ ├── CortexM4OnCMSIS-Core.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── CortexM4OnMBED/
│ │ │ │ │ ├── CortexM4OnMBED.csproj
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ └── SystemTimer.cs
│ │ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ │ ├── GpioProvider.cs
│ │ │ │ │ │ │ ├── I2cProvider.cs
│ │ │ │ │ │ │ └── SpiProvider.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ ├── SpiProvider.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ ├── TimerPool.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── ExternalLinking_Tester/
│ │ │ │ │ ├── ExternalLinking_Tester.csproj
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── FileSystemSample/
│ │ │ │ │ ├── FileSystemSample.csproj
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── ModelForCortexM/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── ChipSet/
│ │ │ │ │ │ │ └── StandardPeripherals/
│ │ │ │ │ │ │ ├── NVIC.cs
│ │ │ │ │ │ │ └── SysTick.cs
│ │ │ │ │ │ └── Drivers/
│ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ ├── ModelForCortexM.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForCortexM0/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForCortexM0.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForCortexM3/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForCortexM3.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForCortexM4/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Board.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── ContextSwitchTimer.cs
│ │ │ │ │ │ │ └── InterruptController.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForCortexM4.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForLPC3180/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── ChipSet/
│ │ │ │ │ │ │ ├── LPC3180/
│ │ │ │ │ │ │ │ ├── GPDMA.cs
│ │ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ │ ├── HighSpeedTimer.cs
│ │ │ │ │ │ │ │ ├── INTC.cs
│ │ │ │ │ │ │ │ ├── MilliSecondTimer.cs
│ │ │ │ │ │ │ │ ├── MultiLevelNANDController.cs
│ │ │ │ │ │ │ │ ├── SDRAMController.cs
│ │ │ │ │ │ │ │ ├── StandardUART.cs
│ │ │ │ │ │ │ │ └── SystemControl.cs
│ │ │ │ │ │ │ └── LPC3180.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── RealTimeClock.cs
│ │ │ │ │ │ │ └── StandardSerialPort.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForLPC3180.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── SchedulerTimeImpl.cs
│ │ │ │ │ ├── SchedulerTimeSpanImpl.cs
│ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForMM9691LP/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── ChipSet/
│ │ │ │ │ │ │ └── MM9691LP/
│ │ │ │ │ │ │ ├── APC.cs
│ │ │ │ │ │ │ ├── ARMTIMER0.cs
│ │ │ │ │ │ │ ├── ARMTIMER1.cs
│ │ │ │ │ │ │ ├── ARMTIMERx.cs
│ │ │ │ │ │ │ ├── BUSWATCHER.cs
│ │ │ │ │ │ │ ├── CMU.cs
│ │ │ │ │ │ │ ├── DMAC.cs
│ │ │ │ │ │ │ ├── EBIU.cs
│ │ │ │ │ │ │ ├── EDMAIF.cs
│ │ │ │ │ │ │ ├── FILTERARCTAN.cs
│ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ ├── INTC.cs
│ │ │ │ │ │ │ ├── MWSPI.cs
│ │ │ │ │ │ │ ├── PCU.cs
│ │ │ │ │ │ │ ├── REMAP_PAUSE.cs
│ │ │ │ │ │ │ ├── RTC.cs
│ │ │ │ │ │ │ ├── SECURITYKEY.cs
│ │ │ │ │ │ │ ├── USART0.cs
│ │ │ │ │ │ │ ├── USART1.cs
│ │ │ │ │ │ │ ├── USARTx.cs
│ │ │ │ │ │ │ ├── USB.cs
│ │ │ │ │ │ │ ├── VITERBI.cs
│ │ │ │ │ │ │ └── VTU32.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── RealTimeClock.cs
│ │ │ │ │ │ │ └── SerialPort.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForMM9691LP.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── SchedulerTimeImpl.cs
│ │ │ │ │ ├── SchedulerTimeSpanImpl.cs
│ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForPXA27x/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── ChipSet/
│ │ │ │ │ │ │ ├── PXA27x/
│ │ │ │ │ │ │ │ ├── ClockManager.cs
│ │ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ │ ├── I2C.cs
│ │ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ │ ├── MemoryController.cs
│ │ │ │ │ │ │ │ ├── OSTimers.cs
│ │ │ │ │ │ │ │ ├── PowerManager.cs
│ │ │ │ │ │ │ │ ├── SSP.cs
│ │ │ │ │ │ │ │ ├── StackedFlashChip.cs
│ │ │ │ │ │ │ │ └── UART.cs
│ │ │ │ │ │ │ └── PXA27x.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ ├── I2C.cs
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── RealTimeClock.cs
│ │ │ │ │ │ │ ├── SPI.cs
│ │ │ │ │ │ │ └── SerialPort.cs
│ │ │ │ │ │ └── Processor.cs
│ │ │ │ │ ├── ModelForPXA27x.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── SchedulerTimeImpl.cs
│ │ │ │ │ ├── SchedulerTimeSpanImpl.cs
│ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ └── ThreadManager.cs
│ │ │ │ ├── ModelForWin32/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── HardwareProviders/
│ │ │ │ │ │ │ └── HardwareProvider.cs
│ │ │ │ │ │ ├── InterruptsSafeHandle.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── SerialPortsManager.cs
│ │ │ │ │ ├── ModelForWin32.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── SchedulerTimeImpl.cs
│ │ │ │ │ ├── SchedulerTimeSpanImpl.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── NohauLPC3180/
│ │ │ │ │ ├── AudioSamples.Designer.cs
│ │ │ │ │ ├── AudioSamples.resx
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ └── RealTimeClock.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── NohauLPC3180.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Resources/
│ │ │ │ │ │ └── sample1.pcm
│ │ │ │ │ └── SystemServices/
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ ├── NohauLPC3180Loader/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ └── RealTimeClock.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Loader.cs
│ │ │ │ │ ├── NohauLPC3180Loader.csproj
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── NohauLPC3180Tester/
│ │ │ │ │ ├── NohauLPC3180Tester.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── Tester.cs
│ │ │ │ ├── Perf/
│ │ │ │ │ ├── Dhrystone/
│ │ │ │ │ │ ├── DhrystoneTest.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── dhrystone.cs
│ │ │ │ │ ├── Whetstone/
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── Whetstone.cs
│ │ │ │ │ │ └── WhetstoneTest.csproj
│ │ │ │ │ └── v8/
│ │ │ │ │ └── crypto/
│ │ │ │ │ └── CryptoTest/
│ │ │ │ │ ├── CryptoTest.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── crypto.cs
│ │ │ │ ├── QuickTest/
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── QuickTest.csproj
│ │ │ │ ├── TestMethodGen/
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── TestMethodGen.csproj
│ │ │ │ ├── VoxSoloFormFactor/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ └── RealTimeClock.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── SystemServices/
│ │ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ │ └── VoxSoloFormFactor.csproj
│ │ │ │ ├── VoxSoloFormFactorLoader/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ └── RealTimeClock.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Loader.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── VoxSoloFormFactorLoader.csproj
│ │ │ │ ├── VoxSoloFormFactorTester/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Tester.cs
│ │ │ │ │ └── VoxSoloFormFactorTester.csproj
│ │ │ │ ├── iMote2/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ ├── I2C.cs
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── RealTimeClock.cs
│ │ │ │ │ │ │ └── SPI.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── SystemServices/
│ │ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ │ ├── ThreadManager.cs
│ │ │ │ │ │ └── TypeSystemManager.cs
│ │ │ │ │ └── iMote2.csproj
│ │ │ │ ├── iMote2Loader/
│ │ │ │ │ ├── HardwareModel/
│ │ │ │ │ │ ├── Device.cs
│ │ │ │ │ │ ├── Drivers/
│ │ │ │ │ │ │ ├── GPIO.cs
│ │ │ │ │ │ │ ├── I2C.cs
│ │ │ │ │ │ │ ├── InterruptController.cs
│ │ │ │ │ │ │ ├── RealTimeClock.cs
│ │ │ │ │ │ │ └── SPI.cs
│ │ │ │ │ │ ├── Memory.cs
│ │ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ │ ├── Processor.cs
│ │ │ │ │ │ └── Storage.cs
│ │ │ │ │ ├── Loader.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── iMote2Loader.csproj
│ │ │ │ ├── iMote2Tester/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Tester.cs
│ │ │ │ │ ├── UnitTests/
│ │ │ │ │ │ ├── I2C.Tests.cs
│ │ │ │ │ │ ├── LED.Tests.cs
│ │ │ │ │ │ ├── Serial.Tests.cs
│ │ │ │ │ │ └── UnitTest.Interface.cs
│ │ │ │ │ └── iMote2Tester.csproj
│ │ │ │ ├── lwIP/
│ │ │ │ │ ├── Microsoft.Llilum.Lwip.csproj
│ │ │ │ │ ├── NetworkInterface.cs
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── mbed/
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── Threading.cs
│ │ │ │ ├── Timer.cs
│ │ │ │ ├── UsTicker.cs
│ │ │ │ ├── Utilities.cs
│ │ │ │ └── mbed.csproj
│ │ │ ├── Framework/
│ │ │ │ ├── Llilum/
│ │ │ │ │ └── Devices/
│ │ │ │ │ ├── Adc/
│ │ │ │ │ │ ├── AdcChannel.cs
│ │ │ │ │ │ ├── AdcChannelInfo.cs
│ │ │ │ │ │ └── AdcPin.cs
│ │ │ │ │ ├── Gpio/
│ │ │ │ │ │ └── GpioPin.cs
│ │ │ │ │ ├── I2c/
│ │ │ │ │ │ ├── I2cChannel.cs
│ │ │ │ │ │ ├── I2cChannelInfo.cs
│ │ │ │ │ │ └── I2cDevice.cs
│ │ │ │ │ ├── Microsoft.Llilum.Devices.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Pwm/
│ │ │ │ │ │ ├── PwmChannel.cs
│ │ │ │ │ │ ├── PwmChannelInfo.cs
│ │ │ │ │ │ └── PwmPin.cs
│ │ │ │ │ └── Spi/
│ │ │ │ │ ├── SpiChannel.cs
│ │ │ │ │ ├── SpiChannelInfo.cs
│ │ │ │ │ └── SpiDevice.cs
│ │ │ │ ├── System.Runtime.WindowsRuntime/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── System.Runtime.WindowsRuntime.csproj
│ │ │ │ │ └── WindowsRuntimeSystemExtensions.cs
│ │ │ │ ├── System_Core/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── System/
│ │ │ │ │ │ ├── FuncAndAction.cs
│ │ │ │ │ │ └── Runtime/
│ │ │ │ │ │ └── CompilerServices/
│ │ │ │ │ │ └── Extension.cs
│ │ │ │ │ └── system_core.csproj
│ │ │ │ ├── Windows/
│ │ │ │ │ ├── Devices/
│ │ │ │ │ │ ├── Adc/
│ │ │ │ │ │ │ ├── AdcChannel.cs
│ │ │ │ │ │ │ ├── AdcChannelMode.cs
│ │ │ │ │ │ │ ├── AdcController.cs
│ │ │ │ │ │ │ ├── IAdcControllerProvider.cs
│ │ │ │ │ │ │ ├── IAdcProvider.cs
│ │ │ │ │ │ │ └── ProviderAdcChannelMode.cs
│ │ │ │ │ │ ├── Enumeration/
│ │ │ │ │ │ │ ├── DeviceInformation.cs
│ │ │ │ │ │ │ └── DeviceInformationCollection.cs
│ │ │ │ │ │ ├── Gpio/
│ │ │ │ │ │ │ ├── DefaultPinProvider.cs
│ │ │ │ │ │ │ ├── GpioController.cs
│ │ │ │ │ │ │ ├── GpioEnums.cs
│ │ │ │ │ │ │ ├── GpioPin.cs
│ │ │ │ │ │ │ ├── GpioPinProvider.cs
│ │ │ │ │ │ │ └── GpioPinValueChangedEventArgs.cs
│ │ │ │ │ │ ├── I2c/
│ │ │ │ │ │ │ ├── I2cConnectionSettings.cs
│ │ │ │ │ │ │ ├── I2cDevice.cs
│ │ │ │ │ │ │ └── I2cEnums.cs
│ │ │ │ │ │ ├── Pwm/
│ │ │ │ │ │ │ ├── DefaultPwmControllerProvider.cs
│ │ │ │ │ │ │ ├── IPwmControllerProvider.cs
│ │ │ │ │ │ │ ├── IPwmProvider.cs
│ │ │ │ │ │ │ ├── PwmController.cs
│ │ │ │ │ │ │ ├── PwmEnums.cs
│ │ │ │ │ │ │ └── PwmPin.cs
│ │ │ │ │ │ ├── SerialCommunication/
│ │ │ │ │ │ │ ├── SerialCommunicationEnums.cs
│ │ │ │ │ │ │ ├── SerialCommunicationEventArgs.cs
│ │ │ │ │ │ │ ├── SerialCommunicationInputStream.cs
│ │ │ │ │ │ │ ├── SerialCommunicationOutputStream.cs
│ │ │ │ │ │ │ └── SerialDevice.cs
│ │ │ │ │ │ └── Spi/
│ │ │ │ │ │ ├── SpiBusInfo.cs
│ │ │ │ │ │ ├── SpiChannel.cs
│ │ │ │ │ │ ├── SpiConnectionSettings.cs
│ │ │ │ │ │ ├── SpiDevice.cs
│ │ │ │ │ │ └── SpiEnums.cs
│ │ │ │ │ ├── Foundation/
│ │ │ │ │ │ ├── Delegates.cs
│ │ │ │ │ │ ├── Enums.cs
│ │ │ │ │ │ ├── IAsyncAction.cs
│ │ │ │ │ │ ├── IAsyncInfo.cs
│ │ │ │ │ │ ├── IAsyncOperation.cs
│ │ │ │ │ │ └── IAsyncOperationWithProgress.cs
│ │ │ │ │ ├── Internal/
│ │ │ │ │ │ ├── AsyncActionFromTask.cs
│ │ │ │ │ │ ├── AsyncOperationFromTask.cs
│ │ │ │ │ │ ├── AsyncOperationWithProgressFromTask.cs
│ │ │ │ │ │ ├── ByteBuffer.cs
│ │ │ │ │ │ ├── SynchronousOperation.cs
│ │ │ │ │ │ └── WindowsRuntimeSystemExtensions.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Storage/
│ │ │ │ │ │ └── Streams/
│ │ │ │ │ │ ├── ByteOrder.cs
│ │ │ │ │ │ ├── DataReader.cs
│ │ │ │ │ │ ├── DataReaderLoadOperation.cs
│ │ │ │ │ │ ├── DataWriter.cs
│ │ │ │ │ │ ├── DataWriterStoreOperation.cs
│ │ │ │ │ │ ├── IBuffer.cs
│ │ │ │ │ │ ├── IInputStream.cs
│ │ │ │ │ │ └── IOutputStream.cs
│ │ │ │ │ ├── System/
│ │ │ │ │ │ └── Threading/
│ │ │ │ │ │ ├── ThreadPool.cs
│ │ │ │ │ │ ├── ThreadPoolTimer.cs
│ │ │ │ │ │ ├── ThreadingDelegates.cs
│ │ │ │ │ │ └── ThreadingEnums.cs
│ │ │ │ │ └── Windows.csproj
│ │ │ │ ├── mscorlib/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── System/
│ │ │ │ │ │ ├── Action.cs
│ │ │ │ │ │ ├── Activator.cs
│ │ │ │ │ │ ├── AggregateException.cs
│ │ │ │ │ │ ├── ApplicationException.cs
│ │ │ │ │ │ ├── ArgumentException.cs
│ │ │ │ │ │ ├── ArgumentNullException.cs
│ │ │ │ │ │ ├── ArgumentOutOfRangeException.cs
│ │ │ │ │ │ ├── ArithmeticException.cs
│ │ │ │ │ │ ├── Array.cs
│ │ │ │ │ │ ├── ArrayTypeMismatchException.cs
│ │ │ │ │ │ ├── AssemblyHandle.cs
│ │ │ │ │ │ ├── AsyncCallback.cs
│ │ │ │ │ │ ├── Attribute.cs
│ │ │ │ │ │ ├── AttributeTargets.cs
│ │ │ │ │ │ ├── AttributeUsageAttribute.cs
│ │ │ │ │ │ ├── BCLDebug.cs
│ │ │ │ │ │ ├── BitConverter.cs
│ │ │ │ │ │ ├── Boolean.cs
│ │ │ │ │ │ ├── Buffer.cs
│ │ │ │ │ │ ├── Byte.cs
│ │ │ │ │ │ ├── CLSCompliantAttribute.cs
│ │ │ │ │ │ ├── Char.cs
│ │ │ │ │ │ ├── CharEnumerator.cs
│ │ │ │ │ │ ├── Collections/
│ │ │ │ │ │ │ ├── ArrayList.cs
│ │ │ │ │ │ │ ├── BitArray.cs
│ │ │ │ │ │ │ ├── Comparer.cs
│ │ │ │ │ │ │ ├── DictionaryEntry.cs
│ │ │ │ │ │ │ ├── Generic/
│ │ │ │ │ │ │ │ ├── ArraySortHelper.cs
│ │ │ │ │ │ │ │ ├── Comparer.cs
│ │ │ │ │ │ │ │ ├── Dictionary.cs
│ │ │ │ │ │ │ │ ├── EqualityComparer.cs
│ │ │ │ │ │ │ │ ├── ICollection.cs
│ │ │ │ │ │ │ │ ├── IComparer.cs
│ │ │ │ │ │ │ │ ├── IDictionary.cs
│ │ │ │ │ │ │ │ ├── IEnumerable.cs
│ │ │ │ │ │ │ │ ├── IEnumerator.cs
│ │ │ │ │ │ │ │ ├── IEqualityComparer.cs
│ │ │ │ │ │ │ │ ├── IList.cs
│ │ │ │ │ │ │ │ ├── KeyNotFoundException.cs
│ │ │ │ │ │ │ │ ├── KeyValuePair.cs
│ │ │ │ │ │ │ │ └── List.cs
│ │ │ │ │ │ │ ├── Hashtable.cs
│ │ │ │ │ │ │ ├── ICollection.cs
│ │ │ │ │ │ │ ├── IComparer.cs
│ │ │ │ │ │ │ ├── IDictionary.cs
│ │ │ │ │ │ │ ├── IDictionaryEnumerator.cs
│ │ │ │ │ │ │ ├── IEnumerable.cs
│ │ │ │ │ │ │ ├── IEnumerator.cs
│ │ │ │ │ │ │ ├── IEqualityComparer.cs
│ │ │ │ │ │ │ ├── IList.cs
│ │ │ │ │ │ │ ├── KeyValuePairs.cs
│ │ │ │ │ │ │ ├── ObjectModel/
│ │ │ │ │ │ │ │ ├── Collection.cs
│ │ │ │ │ │ │ │ ├── KeyedCollection.cs
│ │ │ │ │ │ │ │ └── ReadOnlyCollection.cs
│ │ │ │ │ │ │ ├── Queue.cs
│ │ │ │ │ │ │ ├── ReadOnlyCollectionBase.cs
│ │ │ │ │ │ │ ├── SortedList.cs
│ │ │ │ │ │ │ └── Stack.cs
│ │ │ │ │ │ ├── Configuration/
│ │ │ │ │ │ │ └── Assemblies/
│ │ │ │ │ │ │ ├── AssemblyHashAlgorithm.cs
│ │ │ │ │ │ │ └── AssemblyVersionCompatibility.cs
│ │ │ │ │ │ ├── Console.cs
│ │ │ │ │ │ ├── ConsoleColor.cs
│ │ │ │ │ │ ├── Convert.cs
│ │ │ │ │ │ ├── CurrentTimeZone.cs
│ │ │ │ │ │ ├── DBNull.cs
│ │ │ │ │ │ ├── DateTime.cs
│ │ │ │ │ │ ├── DateTimeKind.cs
│ │ │ │ │ │ ├── DayOfWeek.cs
│ │ │ │ │ │ ├── Decimal.cs
│ │ │ │ │ │ ├── Delegate.cs
│ │ │ │ │ │ ├── Diagnostics/
│ │ │ │ │ │ │ ├── CodeAnalysis/
│ │ │ │ │ │ │ │ └── SuppressMessageAttribute.cs
│ │ │ │ │ │ │ ├── ConditionalAttribute.cs
│ │ │ │ │ │ │ ├── Contracts/
│ │ │ │ │ │ │ │ └── Contracts.cs
│ │ │ │ │ │ │ ├── Debugger.cs
│ │ │ │ │ │ │ ├── DebuggerAttributes.cs
│ │ │ │ │ │ │ ├── StackFrame.cs
│ │ │ │ │ │ │ └── StackTrace.cs
│ │ │ │ │ │ ├── DivideByZeroException.cs
│ │ │ │ │ │ ├── Double.cs
│ │ │ │ │ │ ├── Empty.cs
│ │ │ │ │ │ ├── Enum.cs
│ │ │ │ │ │ ├── Environment.cs
│ │ │ │ │ │ ├── EventArgs.cs
│ │ │ │ │ │ ├── EventHandler.cs
│ │ │ │ │ │ ├── Exception.cs
│ │ │ │ │ │ ├── FlagsAttribute.cs
│ │ │ │ │ │ ├── FormatException.cs
│ │ │ │ │ │ ├── GC.cs
│ │ │ │ │ │ ├── Globalization/
│ │ │ │ │ │ │ ├── BaseInfoTable.cs
│ │ │ │ │ │ │ ├── Calendar.cs
│ │ │ │ │ │ │ ├── CalendarAlgorithmType.cs
│ │ │ │ │ │ │ ├── CalendarTable.cs
│ │ │ │ │ │ │ ├── CalendarWeekRule.cs
│ │ │ │ │ │ │ ├── CharUnicodeInfo.cs
│ │ │ │ │ │ │ ├── CompareInfo.cs
│ │ │ │ │ │ │ ├── CultureInfo.cs
│ │ │ │ │ │ │ ├── CultureTableRecord.cs
│ │ │ │ │ │ │ ├── DateTimeFormat.cs
│ │ │ │ │ │ │ ├── DateTimeFormatInfo.cs
│ │ │ │ │ │ │ ├── DateTimeParse.cs
│ │ │ │ │ │ │ ├── DateTimeStyles.cs
│ │ │ │ │ │ │ ├── DaylightTime.cs
│ │ │ │ │ │ │ ├── DigitShapes.cs
│ │ │ │ │ │ │ ├── GregorianCalendar.cs
│ │ │ │ │ │ │ ├── GregorianCalendarTypes.cs
│ │ │ │ │ │ │ ├── NumberFormatInfo.cs
│ │ │ │ │ │ │ ├── NumberStyles.cs
│ │ │ │ │ │ │ └── TextInfo.cs
│ │ │ │ │ │ ├── Guid.cs
│ │ │ │ │ │ ├── IAsyncResult.cs
│ │ │ │ │ │ ├── ICloneable.cs
│ │ │ │ │ │ ├── IComparable.cs
│ │ │ │ │ │ ├── IConvertible.cs
│ │ │ │ │ │ ├── ICustomFormatter.cs
│ │ │ │ │ │ ├── IDisposable.cs
│ │ │ │ │ │ ├── IEquatable.cs
│ │ │ │ │ │ ├── IFormatProvider.cs
│ │ │ │ │ │ ├── IFormattable.cs
│ │ │ │ │ │ ├── IO/
│ │ │ │ │ │ │ ├── BinaryReader.cs
│ │ │ │ │ │ │ ├── BinaryWriter.cs
│ │ │ │ │ │ │ ├── Directory.cs
│ │ │ │ │ │ │ ├── DirectoryInfo.cs
│ │ │ │ │ │ │ ├── EndOfStreamException.cs
│ │ │ │ │ │ │ ├── File.cs
│ │ │ │ │ │ │ ├── FileAccess.cs
│ │ │ │ │ │ │ ├── FileAttributes.cs
│ │ │ │ │ │ │ ├── FileEnum.cs
│ │ │ │ │ │ │ ├── FileInfo.cs
│ │ │ │ │ │ │ ├── FileMode.cs
│ │ │ │ │ │ │ ├── FileShare.cs
│ │ │ │ │ │ │ ├── FileStream.cs
│ │ │ │ │ │ │ ├── FileSystemInfo.cs
│ │ │ │ │ │ │ ├── FileSystemManager.cs
│ │ │ │ │ │ │ ├── IO.cs
│ │ │ │ │ │ │ ├── IOException.cs
│ │ │ │ │ │ │ ├── MediaManager.cs
│ │ │ │ │ │ │ ├── MemoryStream.cs
│ │ │ │ │ │ │ ├── Path.cs
│ │ │ │ │ │ │ ├── SeekOrigin.cs
│ │ │ │ │ │ │ ├── Stream.cs
│ │ │ │ │ │ │ ├── StreamReader.cs
│ │ │ │ │ │ │ ├── StreamWriter.cs
│ │ │ │ │ │ │ ├── TextReader.cs
│ │ │ │ │ │ │ ├── TextWriter.cs
│ │ │ │ │ │ │ └── __Error.cs
│ │ │ │ │ │ ├── IServiceObjectProvider.cs
│ │ │ │ │ │ ├── IndexOutOfRangeException.cs
│ │ │ │ │ │ ├── Int16.cs
│ │ │ │ │ │ ├── Int32.cs
│ │ │ │ │ │ ├── Int64.cs
│ │ │ │ │ │ ├── IntPtr.cs
│ │ │ │ │ │ ├── InvalidCastException.cs
│ │ │ │ │ │ ├── InvalidOperationException.cs
│ │ │ │ │ │ ├── InvalidProgramException.cs
│ │ │ │ │ │ ├── MarshalByRefObject.cs
│ │ │ │ │ │ ├── Math.cs
│ │ │ │ │ │ ├── MidpointRounding.cs
│ │ │ │ │ │ ├── MulticastDelegate.cs
│ │ │ │ │ │ ├── MulticastNotSupportedException.cs
│ │ │ │ │ │ ├── NonSerializedAttribute.cs
│ │ │ │ │ │ ├── NotFiniteNumberException.cs
│ │ │ │ │ │ ├── NotImplementedException.cs
│ │ │ │ │ │ ├── NotSupportedException.cs
│ │ │ │ │ │ ├── NullReferenceException.cs
│ │ │ │ │ │ ├── Nullable.cs
│ │ │ │ │ │ ├── Number.cs
│ │ │ │ │ │ ├── Object.cs
│ │ │ │ │ │ ├── ObjectDisposedException.cs
│ │ │ │ │ │ ├── ObsoleteAttribute.cs
│ │ │ │ │ │ ├── OperationCanceledException.cs
│ │ │ │ │ │ ├── OutOfMemoryException.cs
│ │ │ │ │ │ ├── OverflowException.cs
│ │ │ │ │ │ ├── ParamArrayAttribute.cs
│ │ │ │ │ │ ├── ParseNumbers.cs
│ │ │ │ │ │ ├── Random.cs
│ │ │ │ │ │ ├── RankException.cs
│ │ │ │ │ │ ├── Reflection/
│ │ │ │ │ │ │ ├── Assembly.cs
│ │ │ │ │ │ │ ├── AssemblyAttributes.cs
│ │ │ │ │ │ │ ├── Binder.cs
│ │ │ │ │ │ │ ├── BindingFlags.cs
│ │ │ │ │ │ │ ├── CallingConventions.cs
│ │ │ │ │ │ │ ├── ConstructorInfo.cs
│ │ │ │ │ │ │ ├── DefaultMemberAttribute.cs
│ │ │ │ │ │ │ ├── EventInfo.cs
│ │ │ │ │ │ │ ├── FieldInfo.cs
│ │ │ │ │ │ │ ├── ICustomAttributeProvider.cs
│ │ │ │ │ │ │ ├── IReflect.cs
│ │ │ │ │ │ │ ├── InterfaceMapping.cs
│ │ │ │ │ │ │ ├── MemberInfo.cs
│ │ │ │ │ │ │ ├── MemberTypes.cs
│ │ │ │ │ │ │ ├── MethodAttributes.cs
│ │ │ │ │ │ │ ├── MethodBase.cs
│ │ │ │ │ │ │ ├── MethodImplAttributes.cs
│ │ │ │ │ │ │ ├── MethodInfo.cs
│ │ │ │ │ │ │ ├── Module.cs
│ │ │ │ │ │ │ ├── ParameterAttributes.cs
│ │ │ │ │ │ │ ├── ParameterInfo.cs
│ │ │ │ │ │ │ ├── ParameterModifier.cs
│ │ │ │ │ │ │ ├── PropertyInfo.cs
│ │ │ │ │ │ │ ├── RuntimeConstructorInfo.cs
│ │ │ │ │ │ │ ├── RuntimeEventInfo.cs
│ │ │ │ │ │ │ ├── RuntimeFieldInfo.cs
│ │ │ │ │ │ │ ├── RuntimeMethodInfo.cs
│ │ │ │ │ │ │ ├── RuntimePropertyInfo.cs
│ │ │ │ │ │ │ ├── TypeAttributes.cs
│ │ │ │ │ │ │ └── TypeFilter.cs
│ │ │ │ │ │ ├── Resources/
│ │ │ │ │ │ │ └── ResourceManager.cs
│ │ │ │ │ │ ├── Runtime/
│ │ │ │ │ │ │ ├── CompilerServices/
│ │ │ │ │ │ │ │ ├── AsyncStateMachineAttribute.cs
│ │ │ │ │ │ │ │ ├── AsyncTaskMethodBuilder.cs
│ │ │ │ │ │ │ │ ├── CompilationRelaxations.cs
│ │ │ │ │ │ │ │ ├── CompilerGeneratedAttribute.cs
│ │ │ │ │ │ │ │ ├── DecimalConstantAttribute.cs
│ │ │ │ │ │ │ │ ├── ExtensionAttribute.cs
│ │ │ │ │ │ │ │ ├── IAsyncStateMachine.cs
│ │ │ │ │ │ │ │ ├── INotifyCompletion.cs
│ │ │ │ │ │ │ │ ├── IndexerNameAttribute.cs
│ │ │ │ │ │ │ │ ├── InternalsVisibleToAttribute.cs
│ │ │ │ │ │ │ │ ├── IsVolatile.cs
│ │ │ │ │ │ │ │ ├── JitHelpers.cs
│ │ │ │ │ │ │ │ ├── MethodImplAttribute.cs
│ │ │ │ │ │ │ │ ├── RuntimeCompatibilityAttribute.cs
│ │ │ │ │ │ │ │ ├── RuntimeHelpers.cs
│ │ │ │ │ │ │ │ ├── SpecialNameAttribute.cs
│ │ │ │ │ │ │ │ ├── StateMachineAttribute.cs
│ │ │ │ │ │ │ │ ├── TaskAwaiter.cs
│ │ │ │ │ │ │ │ ├── TypeForwardedFromAttribute.cs
│ │ │ │ │ │ │ │ └── UnsafeValueTypeAttribute.cs
│ │ │ │ │ │ │ ├── InteropServices/
│ │ │ │ │ │ │ │ ├── Attributes.cs
│ │ │ │ │ │ │ │ ├── CallingConvention.cs
│ │ │ │ │ │ │ │ ├── CharSet.cs
│ │ │ │ │ │ │ │ ├── LayoutKind.cs
│ │ │ │ │ │ │ │ └── Marshal.cs
│ │ │ │ │ │ │ ├── Reliability/
│ │ │ │ │ │ │ │ ├── CriticalFinalizerObject.cs
│ │ │ │ │ │ │ │ ├── PrePrepareMethodAttribute.cs
│ │ │ │ │ │ │ │ └── ReliabilityContractAttribute.cs
│ │ │ │ │ │ │ └── Serialization/
│ │ │ │ │ │ │ ├── SerializationAttributes.cs
│ │ │ │ │ │ │ └── SerializationException.cs
│ │ │ │ │ │ ├── RuntimeArgumentHandle.cs
│ │ │ │ │ │ ├── RuntimeFieldHandle.cs
│ │ │ │ │ │ ├── RuntimeMethodHandle.cs
│ │ │ │ │ │ ├── RuntimeType.cs
│ │ │ │ │ │ ├── RuntimeTypeHandle.cs
│ │ │ │ │ │ ├── SByte.cs
│ │ │ │ │ │ ├── Security/
│ │ │ │ │ │ │ ├── Attributes.cs
│ │ │ │ │ │ │ ├── Cryptography/
│ │ │ │ │ │ │ │ └── X509Certificates/
│ │ │ │ │ │ │ │ └── X509Certificate.cs
│ │ │ │ │ │ │ └── Permissions/
│ │ │ │ │ │ │ ├── HostProtectionPermission.cs
│ │ │ │ │ │ │ ├── PermissionAttributes.cs
│ │ │ │ │ │ │ ├── PermissionState.cs
│ │ │ │ │ │ │ └── SecurityPermission.cs
│ │ │ │ │ │ ├── SerializableAttribute.cs
│ │ │ │ │ │ ├── Single.cs
│ │ │ │ │ │ ├── StackOverflowException.cs
│ │ │ │ │ │ ├── String.cs
│ │ │ │ │ │ ├── StringComparer.cs
│ │ │ │ │ │ ├── StringComparison.cs
│ │ │ │ │ │ ├── SystemException.cs
│ │ │ │ │ │ ├── TargetFrameworkAttribute.cs
│ │ │ │ │ │ ├── Text/
│ │ │ │ │ │ │ ├── ASCIIEncoding.cs
│ │ │ │ │ │ │ ├── Decoder.cs
│ │ │ │ │ │ │ ├── DecoderBestFitFallback.cs
│ │ │ │ │ │ │ ├── DecoderExceptionFallback.cs
│ │ │ │ │ │ │ ├── DecoderFallback.cs
│ │ │ │ │ │ │ ├── DecoderNLS.cs
│ │ │ │ │ │ │ ├── DecoderReplacementFallback.cs
│ │ │ │ │ │ │ ├── Encoder.cs
│ │ │ │ │ │ │ ├── EncoderBestFitFallback.cs
│ │ │ │ │ │ │ ├── EncoderExceptionFallback.cs
│ │ │ │ │ │ │ ├── EncoderFallback.cs
│ │ │ │ │ │ │ ├── EncoderNLS.cs
│ │ │ │ │ │ │ ├── EncoderReplacementFallback.cs
│ │ │ │ │ │ │ ├── Encoding.cs
│ │ │ │ │ │ │ ├── StringBuilder.cs
│ │ │ │ │ │ │ ├── UTF8Encoding.cs
│ │ │ │ │ │ │ └── UnicodeEncoding.cs
│ │ │ │ │ │ ├── ThreadStaticAttribute.cs
│ │ │ │ │ │ ├── Threading/
│ │ │ │ │ │ │ ├── ApartmentState.cs
│ │ │ │ │ │ │ ├── AutoResetEvent.cs
│ │ │ │ │ │ │ ├── CancellationToken.cs
│ │ │ │ │ │ │ ├── CancellationTokenRegistration.cs
│ │ │ │ │ │ │ ├── CancellationTokenSource.cs
│ │ │ │ │ │ │ ├── EventResetMode.cs
│ │ │ │ │ │ │ ├── EventWaitHandle.cs
│ │ │ │ │ │ │ ├── Interlocked.cs
│ │ │ │ │ │ │ ├── ManualResetEvent.cs
│ │ │ │ │ │ │ ├── Monitor.cs
│ │ │ │ │ │ │ ├── Mutex.cs
│ │ │ │ │ │ │ ├── ParameterizedThreadStart.cs
│ │ │ │ │ │ │ ├── SpinWait.cs
│ │ │ │ │ │ │ ├── Tasks/
│ │ │ │ │ │ │ │ ├── GenericTask.cs
│ │ │ │ │ │ │ │ ├── Task.cs
│ │ │ │ │ │ │ │ ├── TaskCanceledException.cs
│ │ │ │ │ │ │ │ ├── TaskContinuation.cs
│ │ │ │ │ │ │ │ └── TaskScheduler.cs
│ │ │ │ │ │ │ ├── Thread.cs
│ │ │ │ │ │ │ ├── ThreadAbortException.cs
│ │ │ │ │ │ │ ├── ThreadPool.cs
│ │ │ │ │ │ │ ├── ThreadPriority.cs
│ │ │ │ │ │ │ ├── ThreadStart.cs
│ │ │ │ │ │ │ ├── ThreadStartException.cs
│ │ │ │ │ │ │ ├── ThreadState.cs
│ │ │ │ │ │ │ ├── ThreadStateException.cs
│ │ │ │ │ │ │ ├── Timeout.cs
│ │ │ │ │ │ │ ├── Timer.cs
│ │ │ │ │ │ │ ├── Volatile.cs
│ │ │ │ │ │ │ └── WaitHandle.cs
│ │ │ │ │ │ ├── ThrowHelper.cs
│ │ │ │ │ │ ├── TimeSpan.cs
│ │ │ │ │ │ ├── TimeZone.cs
│ │ │ │ │ │ ├── TimeoutException.cs
│ │ │ │ │ │ ├── Type.cs
│ │ │ │ │ │ ├── TypeCode.cs
│ │ │ │ │ │ ├── TypedReference.cs
│ │ │ │ │ │ ├── UInt16.cs
│ │ │ │ │ │ ├── UInt32.cs
│ │ │ │ │ │ ├── UInt64.cs
│ │ │ │ │ │ ├── UIntPtr.cs
│ │ │ │ │ │ ├── UnSafeCharBuffer.cs
│ │ │ │ │ │ ├── UnauthorizedAccessException.cs
│ │ │ │ │ │ ├── ValueType.cs
│ │ │ │ │ │ ├── Version.cs
│ │ │ │ │ │ ├── Void.cs
│ │ │ │ │ │ └── WeakReference.cs
│ │ │ │ │ ├── ZeligHooks/
│ │ │ │ │ │ ├── TypeDependencyAttribute.cs
│ │ │ │ │ │ ├── WellKnownFieldAttribute.cs
│ │ │ │ │ │ ├── WellKnownMethodAttribute.cs
│ │ │ │ │ │ └── WellKnownTypeAttribute.cs
│ │ │ │ │ └── mscorlib.csproj
│ │ │ │ ├── mscorlib_UnitTest/
│ │ │ │ │ ├── Files.Designer.cs
│ │ │ │ │ ├── Files.resx
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Resources/
│ │ │ │ │ │ └── ZeligRefreshBinaryDrop.cmd
│ │ │ │ │ ├── Test_OpenClasses.cs
│ │ │ │ │ ├── Verify.cs
│ │ │ │ │ └── mscorlib_UnitTest.csproj
│ │ │ │ └── system/
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── System/
│ │ │ │ │ ├── CodeDOM/
│ │ │ │ │ │ └── Compiler/
│ │ │ │ │ │ └── GeneratedCodeAttribute.cs
│ │ │ │ │ ├── Collections/
│ │ │ │ │ │ └── Generic/
│ │ │ │ │ │ ├── LinkedList.cs
│ │ │ │ │ │ └── Queue.cs
│ │ │ │ │ ├── ComponentModel/
│ │ │ │ │ │ ├── Component.cs
│ │ │ │ │ │ ├── ComponentCollection.cs
│ │ │ │ │ │ ├── EditorBrowsableAttribute.cs
│ │ │ │ │ │ ├── EventHandlerList.cs
│ │ │ │ │ │ ├── IComponent.cs
│ │ │ │ │ │ ├── IContainer.cs
│ │ │ │ │ │ └── ISite.cs
│ │ │ │ │ ├── Diagnostics/
│ │ │ │ │ │ ├── Debug.cs
│ │ │ │ │ │ ├── DefaultTraceListener.cs
│ │ │ │ │ │ ├── Stopwatch.cs
│ │ │ │ │ │ ├── Trace.cs
│ │ │ │ │ │ ├── TraceEventCache.cs
│ │ │ │ │ │ ├── TraceEventType.cs
│ │ │ │ │ │ ├── TraceFilter.cs
│ │ │ │ │ │ ├── TraceInternal.cs
│ │ │ │ │ │ ├── TraceListener.cs
│ │ │ │ │ │ ├── TraceListeners.cs
│ │ │ │ │ │ └── TraceOption.cs
│ │ │ │ │ ├── HTTP/
│ │ │ │ │ │ ├── System.Net.AuthenticationType.cs
│ │ │ │ │ │ ├── System.Net.HttpListener.cs
│ │ │ │ │ │ ├── System.Net.HttpListenerContext.cs
│ │ │ │ │ │ ├── System.Net.HttpListenerRequest.cs
│ │ │ │ │ │ ├── System.Net.HttpListenerResponse.cs
│ │ │ │ │ │ ├── System.Net.HttpStatusCode.cs
│ │ │ │ │ │ ├── System.Net.HttpVersion.cs
│ │ │ │ │ │ ├── System.Net.HttpWebRequest.cs
│ │ │ │ │ │ ├── System.Net.HttpWebResponse.cs
│ │ │ │ │ │ ├── System.Net.IWebProxy.cs
│ │ │ │ │ │ ├── System.Net.IWebRequestCreate.cs
│ │ │ │ │ │ ├── System.Net.Internal.cs
│ │ │ │ │ │ ├── System.Net.NetworkCredential.cs
│ │ │ │ │ │ ├── System.Net.ProtocolViolationException.cs
│ │ │ │ │ │ ├── System.Net.WebException.cs
│ │ │ │ │ │ ├── System.Net.WebHeaders.cs
│ │ │ │ │ │ ├── System.Net.WebProxy.cs
│ │ │ │ │ │ ├── System.Net.WebRequest.cs
│ │ │ │ │ │ ├── System.Net.WebResponse.cs
│ │ │ │ │ │ ├── System.Net.WebStatus.cs
│ │ │ │ │ │ ├── System.Net._HeaderInfo.cs
│ │ │ │ │ │ ├── System.Net._HeaderInfoTable.cs
│ │ │ │ │ │ ├── System.Net._HttpDateParse.cs
│ │ │ │ │ │ ├── System.Net._InputNetworkStreamWrapper.cs
│ │ │ │ │ │ ├── System.Net._OutputNetworkStreamWrapper.cs
│ │ │ │ │ │ ├── System.Net._ValidationHelper.cs
│ │ │ │ │ │ └── System.Uri.cs
│ │ │ │ │ ├── IO/
│ │ │ │ │ │ └── Ports/
│ │ │ │ │ │ ├── Handshake.cs
│ │ │ │ │ │ ├── InternalResources.cs
│ │ │ │ │ │ ├── Parity.cs
│ │ │ │ │ │ ├── SerialErrors.cs
│ │ │ │ │ │ ├── SerialPinChanges.cs
│ │ │ │ │ │ ├── SerialPort.cs
│ │ │ │ │ │ ├── SerialReceived.cs
│ │ │ │ │ │ ├── SerialStream.cs
│ │ │ │ │ │ └── StopBits.cs
│ │ │ │ │ └── Net/
│ │ │ │ │ ├── DNS.cs
│ │ │ │ │ ├── EndPoint.cs
│ │ │ │ │ ├── IPAddress.cs
│ │ │ │ │ ├── IPEndPoint.cs
│ │ │ │ │ ├── IPHostEntry.cs
│ │ │ │ │ ├── Internal/
│ │ │ │ │ │ └── SocketNative.cs
│ │ │ │ │ ├── SocketAddress.cs
│ │ │ │ │ ├── SocketException.cs
│ │ │ │ │ └── Sockets/
│ │ │ │ │ ├── AddressFamily.cs
│ │ │ │ │ ├── NetworkStream.cs
│ │ │ │ │ ├── ProtocolFamily.cs
│ │ │ │ │ ├── ProtocolType.cs
│ │ │ │ │ ├── SelectMode.cs
│ │ │ │ │ ├── Socket.cs
│ │ │ │ │ ├── SocketErrors.cs
│ │ │ │ │ ├── SocketFlags.cs
│ │ │ │ │ ├── SocketOptionLevel.cs
│ │ │ │ │ ├── SocketOptionName.cs
│ │ │ │ │ └── SocketType.cs
│ │ │ │ └── system.csproj
│ │ │ └── Zelig/
│ │ │ ├── Common/
│ │ │ │ ├── Attributes/
│ │ │ │ │ ├── CallQualifiers/
│ │ │ │ │ │ ├── ActivationRecordEvents.cs
│ │ │ │ │ │ ├── BottomOfCallStackAttribute.cs
│ │ │ │ │ │ ├── CanAllocateOnReturnAttribute.cs
│ │ │ │ │ │ ├── CannotAllocateAttribute.cs
│ │ │ │ │ │ ├── DebuggerHookHandlerAttribute.cs
│ │ │ │ │ │ ├── DisableBoundsChecksAttribute.cs
│ │ │ │ │ │ ├── DisableNullChecksAttribute.cs
│ │ │ │ │ │ ├── ExportedMethodAttribute.cs
│ │ │ │ │ │ ├── HardwareExceptionHandlerAttribute.cs
│ │ │ │ │ │ ├── ImportedMethodReferenceAttribute.cs
│ │ │ │ │ │ ├── InlineAttribute.cs
│ │ │ │ │ │ ├── NoInlineAttribute.cs
│ │ │ │ │ │ ├── NoReturnAttribute.cs
│ │ │ │ │ │ ├── SaveFullProcessorContextAttribute.cs
│ │ │ │ │ │ ├── StackAvailableOnReturnAttribute.cs
│ │ │ │ │ │ └── StackNotAvailableAttribute.cs
│ │ │ │ │ ├── CompileTimeOptions/
│ │ │ │ │ │ ├── AlignmentRequirementsAttribute.cs
│ │ │ │ │ │ ├── ConfigurationOptionAttribute.cs
│ │ │ │ │ │ ├── ForceDevirtualizationAttribute.cs
│ │ │ │ │ │ ├── ImplicitInstanceAttribute.cs
│ │ │ │ │ │ ├── MemoryRequirementsAttribute.cs
│ │ │ │ │ │ ├── MemoryUsageAttribute.cs
│ │ │ │ │ │ └── SingletonFactoryAttribute.cs
│ │ │ │ │ ├── HardwareModeling/
│ │ │ │ │ │ ├── BitFieldPeripheralAttribute.cs
│ │ │ │ │ │ ├── BitFieldRegisterAttribute.cs
│ │ │ │ │ │ ├── BitFieldSplitRegisterAttribute.cs
│ │ │ │ │ │ ├── MemoryMappedPeripheralAttribute.cs
│ │ │ │ │ │ └── RegisterAttribute.cs
│ │ │ │ │ ├── OpenClasses/
│ │ │ │ │ │ ├── AliasForBaseFieldAttribute.cs
│ │ │ │ │ │ ├── AliasForBaseMethodAttribute.cs
│ │ │ │ │ │ ├── AliasForSuperMethodAttribute.cs
│ │ │ │ │ │ ├── AliasForTargetMethodAttribute.cs
│ │ │ │ │ │ ├── CapabilitiesFilterAttribute.cs
│ │ │ │ │ │ ├── DiscardTargetImplementationAttribute.cs
│ │ │ │ │ │ ├── ExtendClassAttribute.cs
│ │ │ │ │ │ ├── InjectAtEntryPointAttribute.cs
│ │ │ │ │ │ ├── InjectAtExitPointAttribute.cs
│ │ │ │ │ │ ├── MergeWithTargetImplementationAttribute.cs
│ │ │ │ │ │ ├── ProductFilterAttribute.cs
│ │ │ │ │ │ └── SingletonFactoryPlatformFilter.cs
│ │ │ │ │ └── TypeSystem/
│ │ │ │ │ ├── AllowCompileTimeIntrospectionAttribute.cs
│ │ │ │ │ ├── AssumeReferencedAttribute.cs
│ │ │ │ │ ├── DisableAutomaticReferenceCountingAttribute.cs
│ │ │ │ │ ├── DisableReferenceCountingAttribute.cs
│ │ │ │ │ ├── GarbageCollectionExtensionAttribute.cs
│ │ │ │ │ ├── GenerateUnsafeCastAttribute.cs
│ │ │ │ │ ├── LinkToRuntimeTypeAttribute.cs
│ │ │ │ │ ├── NoVTableAttribute.cs
│ │ │ │ │ ├── SkipDuringGarbageCollectionAttribute.cs
│ │ │ │ │ ├── TypeDependencyAttribute.cs
│ │ │ │ │ ├── WellKnownFieldAttribute.cs
│ │ │ │ │ ├── WellKnownMethodAttribute.cs
│ │ │ │ │ ├── WellKnownTypeAttribute.cs
│ │ │ │ │ └── WellKnownTypeLookupAttribute.cs
│ │ │ │ ├── Collections/
│ │ │ │ │ ├── BitVector.cs
│ │ │ │ │ ├── GrowOnlyHashTable.cs
│ │ │ │ │ ├── GrowOnlyList.cs
│ │ │ │ │ ├── GrowOnlySet.cs
│ │ │ │ │ ├── HashHelpers.cs
│ │ │ │ │ ├── ReferenceEqualityComparer.cs
│ │ │ │ │ ├── UniqueList.cs
│ │ │ │ │ └── WeakEqualityComparer.cs
│ │ │ │ ├── Common.csproj
│ │ │ │ ├── Configuration/
│ │ │ │ │ ├── Attributes/
│ │ │ │ │ │ ├── AbstractDefaultsAttribute.cs
│ │ │ │ │ │ ├── AllowedOptionsAttribute.cs
│ │ │ │ │ │ ├── DefaultsAttribute.cs
│ │ │ │ │ │ ├── DependsOnAttribute.cs
│ │ │ │ │ │ ├── DisplayNameAttribute.cs
│ │ │ │ │ │ ├── EnumDefaultsAttribute.cs
│ │ │ │ │ │ ├── HardwareModelAttribute.cs
│ │ │ │ │ │ ├── LinkToConfigurationOptionAttribute.cs
│ │ │ │ │ │ ├── MemorySectionAttribute.cs
│ │ │ │ │ │ ├── MergeEnumDefaultsAttribute.cs
│ │ │ │ │ │ ├── RequiresAttribute.cs
│ │ │ │ │ │ └── ReserveBlockAttribute.cs
│ │ │ │ │ ├── Categories/
│ │ │ │ │ │ ├── AbstractCategory.cs
│ │ │ │ │ │ ├── BusAttachedCategory.cs
│ │ │ │ │ │ ├── BusControllerCategory.cs
│ │ │ │ │ │ ├── CacheControllerCategory.cs
│ │ │ │ │ │ ├── CompilationSetupCategory.cs
│ │ │ │ │ │ ├── DisplayCategory.cs
│ │ │ │ │ │ ├── EngineCategory.cs
│ │ │ │ │ │ ├── FlashMemoryCategory.cs
│ │ │ │ │ │ ├── InteropCategory.cs
│ │ │ │ │ │ ├── JtagLoaderCategory.cs
│ │ │ │ │ │ ├── LoaderCompilationSetupCategory.cs
│ │ │ │ │ │ ├── MemoryCategory.cs
│ │ │ │ │ │ ├── MemoryMapCategory.cs
│ │ │ │ │ │ ├── PeripheralCategory.cs
│ │ │ │ │ │ ├── ProcessorCategory.cs
│ │ │ │ │ │ ├── ProductCategory.cs
│ │ │ │ │ │ └── RamMemoryCategory.cs
│ │ │ │ │ ├── ImageSection.cs
│ │ │ │ │ └── Interfaces/
│ │ │ │ │ └── IMemoryMapper.cs
│ │ │ │ ├── Debugging/
│ │ │ │ │ ├── DebugInfo.cs
│ │ │ │ │ └── MethodDebugInfo.cs
│ │ │ │ ├── Exceptions/
│ │ │ │ │ ├── AssertionViolationException.cs
│ │ │ │ │ ├── IncorrectEncodingException.cs
│ │ │ │ │ ├── NotSupportedException.cs
│ │ │ │ │ └── TypeConsistencyErrorException.cs
│ │ │ │ ├── Helpers/
│ │ │ │ │ ├── AddressMath.cs
│ │ │ │ │ ├── ArrayUtility.cs
│ │ │ │ │ ├── CRC32.cs
│ │ │ │ │ ├── Checks.cs
│ │ │ │ │ ├── DataConversion.cs
│ │ │ │ │ ├── HashTableFactory.cs
│ │ │ │ │ ├── HashTableWithListFactory.cs
│ │ │ │ │ ├── HashTableWithSetFactory.cs
│ │ │ │ │ ├── ReflectionHelper.cs
│ │ │ │ │ └── SetFactory.cs
│ │ │ │ ├── PerformanceCounters/
│ │ │ │ │ ├── ContextualTiming.cs
│ │ │ │ │ └── Timing.cs
│ │ │ │ └── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── CommonPC/
│ │ │ │ ├── CommonPC.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── XmlHelper.cs
│ │ │ ├── Kernel/
│ │ │ │ ├── Bootstrap.cs
│ │ │ │ ├── FrameworkOverrides/
│ │ │ │ │ ├── ActivatorImpl.cs
│ │ │ │ │ ├── ArrayImpl.cs
│ │ │ │ │ ├── BufferImpl.cs
│ │ │ │ │ ├── ConsoleImpl.cs
│ │ │ │ │ ├── CurrentSystemTimeZoneImpl.cs
│ │ │ │ │ ├── DateTimeImpl.cs
│ │ │ │ │ ├── DelegateImpl.cs
│ │ │ │ │ ├── Diagnostics/
│ │ │ │ │ │ ├── DebuggerImpl.cs
│ │ │ │ │ │ └── StopwatchImpl.cs
│ │ │ │ │ ├── EnvironmentImpl.cs
│ │ │ │ │ ├── GCImpl.cs
│ │ │ │ │ ├── Globalization/
│ │ │ │ │ │ ├── CompareInfoImpl.cs
│ │ │ │ │ │ └── TextInfoImpl.cs
│ │ │ │ │ ├── MathImpl.cs
│ │ │ │ │ ├── MulticastDelegateImpl.cs
│ │ │ │ │ ├── NumberImpl.cs
│ │ │ │ │ ├── ObjectImpl.cs
│ │ │ │ │ ├── Reflection/
│ │ │ │ │ │ ├── MemberInfoImpl.cs
│ │ │ │ │ │ ├── RuntimeFieldHandleImpl.cs
│ │ │ │ │ │ ├── RuntimeMethodHandleImpl.cs
│ │ │ │ │ │ └── RuntimeTypeHandleImpl.cs
│ │ │ │ │ ├── Resources/
│ │ │ │ │ │ └── ResourceManagerImpl.cs
│ │ │ │ │ ├── Runtime/
│ │ │ │ │ │ ├── CompilerServices/
│ │ │ │ │ │ │ ├── JitHelpersImpl.cs
│ │ │ │ │ │ │ └── RuntimeHelpersImpl.cs
│ │ │ │ │ │ └── InteropServices/
│ │ │ │ │ │ └── MarshalImpl.cs
│ │ │ │ │ ├── RuntimeTypeImpl.cs
│ │ │ │ │ ├── StringImpl.cs
│ │ │ │ │ ├── Threading/
│ │ │ │ │ │ ├── EventWaitHandleImpl.cs
│ │ │ │ │ │ ├── InterlockedImpl.cs
│ │ │ │ │ │ ├── InterlockedImpl_ARMv6M.cs
│ │ │ │ │ │ ├── MonitorImpl.cs
│ │ │ │ │ │ ├── ThreadImpl.cs
│ │ │ │ │ │ ├── ThreadPoolImpl.cs
│ │ │ │ │ │ ├── TimerImpl.cs
│ │ │ │ │ │ └── WaitHandleImpl.cs
│ │ │ │ │ ├── TypeImpl.cs
│ │ │ │ │ └── WeakReferenceImpl.cs
│ │ │ │ ├── FrameworkOverrides_Llilum/
│ │ │ │ │ └── Devices/
│ │ │ │ │ ├── Adc/
│ │ │ │ │ │ ├── AdcPinImpl.cs
│ │ │ │ │ │ └── AdcProvider.cs
│ │ │ │ │ ├── Gpio/
│ │ │ │ │ │ ├── GpioPinImpl.cs
│ │ │ │ │ │ └── GpioProvider.cs
│ │ │ │ │ ├── I2c/
│ │ │ │ │ │ ├── I2cDeviceImpl.cs
│ │ │ │ │ │ └── I2cProvider.cs
│ │ │ │ │ ├── Pwm/
│ │ │ │ │ │ ├── PwmPinImpl.cs
│ │ │ │ │ │ └── PwmProvider.cs
│ │ │ │ │ └── Spi/
│ │ │ │ │ ├── SpiDeviceImpl.cs
│ │ │ │ │ └── SpiProvider.cs
│ │ │ │ ├── FrameworkOverrides_System/
│ │ │ │ │ ├── Diagnostics/
│ │ │ │ │ │ └── DefaultTraceListernerImpl.cs
│ │ │ │ │ ├── IO/
│ │ │ │ │ │ ├── MediaManagerImpl.cs
│ │ │ │ │ │ ├── NativeFileImpl.cs
│ │ │ │ │ │ └── Ports/
│ │ │ │ │ │ ├── BaseSerialStream.cs
│ │ │ │ │ │ ├── SerialPortImpl.cs
│ │ │ │ │ │ └── SerialStreamImpl.cs
│ │ │ │ │ └── Net/
│ │ │ │ │ ├── IPAddressImpl.cs
│ │ │ │ │ ├── NetworkInterfaceProvider.cs
│ │ │ │ │ ├── SocketNativeImpl.cs
│ │ │ │ │ └── SocketProvider.cs
│ │ │ │ ├── FrameworkOverrides_Windows/
│ │ │ │ │ └── Devices/
│ │ │ │ │ ├── Adc/
│ │ │ │ │ │ ├── AdcControllerImpl.cs
│ │ │ │ │ │ └── AdcProviderUwp.cs
│ │ │ │ │ ├── I2c/
│ │ │ │ │ │ ├── I2cDeviceImplUwp.cs
│ │ │ │ │ │ └── I2cProviderUwp.cs
│ │ │ │ │ ├── Pwm/
│ │ │ │ │ │ ├── PwmControllerImpl.cs
│ │ │ │ │ │ └── PwmProviderUwp.cs
│ │ │ │ │ └── Spi/
│ │ │ │ │ ├── SpiDeviceImplUwp.cs
│ │ │ │ │ └── SpiProviderUwp.cs
│ │ │ │ ├── GarbageCollectors/
│ │ │ │ │ ├── ConservativeMarkAndSweepCollector.cs
│ │ │ │ │ ├── MarkAndSweepCollector.cs
│ │ │ │ │ ├── PreciseMarkAndSweepCollector.cs
│ │ │ │ │ └── ReferenceCountingCollector.cs
│ │ │ │ ├── HardwareModel/
│ │ │ │ │ ├── Device.cs
│ │ │ │ │ ├── HardwareProvider.cs
│ │ │ │ │ ├── Memory.cs
│ │ │ │ │ ├── Peripherals.cs
│ │ │ │ │ ├── Processor.cs
│ │ │ │ │ ├── Storage.cs
│ │ │ │ │ └── TargetPlatform/
│ │ │ │ │ ├── ARMv4/
│ │ │ │ │ │ ├── Coprocessor14.cs
│ │ │ │ │ │ ├── Coprocessor15.cs
│ │ │ │ │ │ ├── InterruptsSafeHandleARMv4.cs
│ │ │ │ │ │ ├── MMUv4.cs
│ │ │ │ │ │ ├── ProcessorARMv4.cs
│ │ │ │ │ │ └── ProcessorARMv4_ContextSwitch.cs
│ │ │ │ │ ├── ARMv5/
│ │ │ │ │ │ ├── ProcessorARMv5.cs
│ │ │ │ │ │ └── ProcessorARMv5_ContextSwitch.cs
│ │ │ │ │ ├── ARMv5_VFP/
│ │ │ │ │ │ ├── BinaryOperations.cs
│ │ │ │ │ │ ├── Convert.cs
│ │ │ │ │ │ ├── ProcessorARMv5_VFP.cs
│ │ │ │ │ │ └── ProcessorARMv5_VFP_ContextSwitch.cs
│ │ │ │ │ ├── ARMv6/
│ │ │ │ │ │ ├── InterruptsSafeHandleARMv6M.cs
│ │ │ │ │ │ ├── ProcessorARMv6M.cs
│ │ │ │ │ │ ├── ProcessorARMv6MForLlvm.cs
│ │ │ │ │ │ └── ProcessorARMv6MForLlvm_ContextSwitch.cs
│ │ │ │ │ ├── ARMv7/
│ │ │ │ │ │ ├── InterruptsSafeHandleARMv7M.cs
│ │ │ │ │ │ ├── ProcessorARMv7M.cs
│ │ │ │ │ │ ├── ProcessorARMv7MForLlvm.cs
│ │ │ │ │ │ └── ProcessorARMv7MForLlvm_ContextSwitch.cs
│ │ │ │ │ ├── ARMv7_VFP/
│ │ │ │ │ │ ├── ProcessorARMv7MForLlvm_VFP.cs
│ │ │ │ │ │ ├── ProcessorARMv7MForLlvm_VFP_ContextSwitch.cs
│ │ │ │ │ │ └── ProcessorARMv7M_VFP.cs
│ │ │ │ │ └── AbstractMethodWrapper.cs
│ │ │ │ ├── Helpers/
│ │ │ │ │ ├── BinaryOperations.cs
│ │ │ │ │ ├── CompareAndSet.cs
│ │ │ │ │ ├── Convert.cs
│ │ │ │ │ ├── DoubleImplementation.cs
│ │ │ │ │ ├── FloatImplementation.cs
│ │ │ │ │ └── UnaryOperations.cs
│ │ │ │ ├── Kernel.csproj
│ │ │ │ ├── ManagedHeap/
│ │ │ │ │ ├── BrickTable.cs
│ │ │ │ │ ├── Finalizer.cs
│ │ │ │ │ ├── GarbageCollectionExtensionHandler.cs
│ │ │ │ │ ├── MemoryFreeBlock.cs
│ │ │ │ │ ├── MemorySegment.cs
│ │ │ │ │ ├── ObjectHeader.cs
│ │ │ │ │ ├── ReleaseReferenceHelper.cs
│ │ │ │ │ ├── SyncBlock.cs
│ │ │ │ │ └── SyncBlockTable.cs
│ │ │ │ ├── MemoryManagers/
│ │ │ │ │ └── LinearMemoryManager.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── SelfTest.cs
│ │ │ │ ├── SmartHandles/
│ │ │ │ │ ├── CriticalSectionHolder.cs
│ │ │ │ │ ├── InterruptState.cs
│ │ │ │ │ ├── SwapCurrentThread.cs
│ │ │ │ │ ├── SwapCurrentThreadUnderInterrupt.cs
│ │ │ │ │ └── YieldLockHolder.cs
│ │ │ │ ├── Support/
│ │ │ │ │ ├── BugCheck.cs
│ │ │ │ │ ├── KernelCircularBuffer.cs
│ │ │ │ │ ├── KernelList.cs
│ │ │ │ │ ├── KernelNode.cs
│ │ │ │ │ ├── KernelPerformanceCounter.cs
│ │ │ │ │ └── LandingPadResult.cs
│ │ │ │ ├── Synchronization/
│ │ │ │ │ ├── CriticalSection.cs
│ │ │ │ │ ├── WaitableObject.cs
│ │ │ │ │ ├── WaitingRecord.cs
│ │ │ │ │ └── YieldLock.cs
│ │ │ │ ├── SystemServices/
│ │ │ │ │ ├── Configuration.cs
│ │ │ │ │ ├── GarbageCollectionManager.cs
│ │ │ │ │ ├── MemoryManager.cs
│ │ │ │ │ ├── SchedulerTime.cs
│ │ │ │ │ ├── SchedulerTimeSpan.cs
│ │ │ │ │ ├── SerialPortsManager.cs
│ │ │ │ │ ├── Threading/
│ │ │ │ │ │ ├── ARMv5ThreadManager.cs
│ │ │ │ │ │ ├── ARMv6ThreadManager.cs
│ │ │ │ │ │ ├── ARMv7ThreadManager.cs
│ │ │ │ │ │ └── ThreadManager.cs
│ │ │ │ │ ├── TypeSystemManager.cs
│ │ │ │ │ └── Unwind.cs
│ │ │ │ └── TypeSystemManagers/
│ │ │ │ └── DefaultTypeSystemManager.cs
│ │ │ ├── LlilumCMSIS-RTOS/
│ │ │ │ ├── API/
│ │ │ │ │ ├── CmsisObject.cs
│ │ │ │ │ ├── CmsisRtos.cs
│ │ │ │ │ ├── CmsisRtosMessageQueue.cs
│ │ │ │ │ ├── CmsisRtosMutex.cs
│ │ │ │ │ ├── CmsisRtosSemaphore.cs
│ │ │ │ │ └── CmsisRtosThread.cs
│ │ │ │ ├── LlilumCMSIS-RTOS.csproj
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── ReadMe.txt
│ │ │ ├── LlilumOSAbstraction/
│ │ │ │ ├── API/
│ │ │ │ │ ├── IO/
│ │ │ │ │ │ ├── Adc.cs
│ │ │ │ │ │ ├── Ethernet.cs
│ │ │ │ │ │ ├── Gpio.cs
│ │ │ │ │ │ ├── I2C.cs
│ │ │ │ │ │ ├── Pwm.cs
│ │ │ │ │ │ ├── SerialPort.cs
│ │ │ │ │ │ ├── Socket.cs
│ │ │ │ │ │ └── Spi.cs
│ │ │ │ │ └── RuntimeMemory.cs
│ │ │ │ ├── HAL/
│ │ │ │ │ ├── Clock.cs
│ │ │ │ │ ├── Mutex.cs
│ │ │ │ │ ├── Thread.cs
│ │ │ │ │ └── Timer.cs
│ │ │ │ ├── LlilumErrors.cs
│ │ │ │ ├── LlilumOSAbstraction.csproj
│ │ │ │ └── Native/
│ │ │ │ └── API/
│ │ │ │ └── RuntimeMemory.cs
│ │ │ └── TypeSystem/
│ │ │ ├── AssemblyRepresentation.cs
│ │ │ ├── BaseRepresentation.cs
│ │ │ ├── CodeMap.cs
│ │ │ ├── CodeMapDecoderCallback.cs
│ │ │ ├── CodePointer.cs
│ │ │ ├── ConversionContext.cs
│ │ │ ├── CustomAttributeAssociationRepresentation.cs
│ │ │ ├── CustomAttributeRepresentation.cs
│ │ │ ├── Environment/
│ │ │ │ ├── IConfigurationProvider.cs
│ │ │ │ └── IEnvironmentProvider.cs
│ │ │ ├── EquivalenceSet.cs
│ │ │ ├── ExceptionMap.cs
│ │ │ ├── Fields/
│ │ │ │ ├── FieldRepresentation.cs
│ │ │ │ ├── InstanceFieldRepresentation.cs
│ │ │ │ └── StaticFieldRepresentation.cs
│ │ │ ├── GCInfo.cs
│ │ │ ├── GenericInstantiationClosure.cs
│ │ │ ├── GenericParameterDefinition.cs
│ │ │ ├── GlobalRoot.cs
│ │ │ ├── InstantiationContext.cs
│ │ │ ├── Methods/
│ │ │ │ ├── ConstructorMethodRepresentation.cs
│ │ │ │ ├── FinalMethodRepresentation.cs
│ │ │ │ ├── FinalizerMethodRepresentation.cs
│ │ │ │ ├── InstanceMethodRepresentation.cs
│ │ │ │ ├── MethodImplRepresentation.cs
│ │ │ │ ├── MethodRepresentation.cs
│ │ │ │ ├── NotVirtualMethodRepresentation.cs
│ │ │ │ ├── RuntimeMethodRepresentation.cs
│ │ │ │ ├── StaticConstructorMethodRepresentation.cs
│ │ │ │ ├── StaticMethodRepresentation.cs
│ │ │ │ └── VirtualMethodRepresentation.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── ResourceRepresentation.cs
│ │ │ ├── StackEquivalentType.cs
│ │ │ ├── TransformationContext.cs
│ │ │ ├── TypeSystem.cs
│ │ │ ├── TypeSystem.csproj
│ │ │ ├── Types/
│ │ │ │ ├── AbstractReferenceTypeRepresentation.cs
│ │ │ │ ├── ArrayReferenceTypeRepresentation.cs
│ │ │ │ ├── BoxedValueTypeRepresentation.cs
│ │ │ │ ├── ConcreteReferenceTypeRepresentation.cs
│ │ │ │ ├── DelayedMethodParameterTypeRepresentation.cs
│ │ │ │ ├── DelayedTypeParameterTypeRepresentation.cs
│ │ │ │ ├── EnumerationTypeRepresentation.cs
│ │ │ │ ├── InterfaceTypeRepresentation.cs
│ │ │ │ ├── ManagedPointerTypeRepresentation.cs
│ │ │ │ ├── MultiArrayReferenceTypeRepresentation.cs
│ │ │ │ ├── PinnedPointerTypeRepresentation.cs
│ │ │ │ ├── PointerTypeRepresentation.cs
│ │ │ │ ├── ReferenceTypeRepresentation.cs
│ │ │ │ ├── ScalarTypeRepresentation.cs
│ │ │ │ ├── SzArrayReferenceTypeRepresentation.cs
│ │ │ │ ├── TypeRepresentation.cs
│ │ │ │ ├── UnmanagedPointerTypeRepresentation.cs
│ │ │ │ └── ValueTypeRepresentation.cs
│ │ │ ├── VTable.cs
│ │ │ ├── WellKnownFields.cs
│ │ │ ├── WellKnownMethods.cs
│ │ │ └── WellKnownTypes.cs
│ │ ├── Test/
│ │ │ ├── Common/
│ │ │ │ ├── Assert.cs
│ │ │ │ ├── Console.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── SpotTestLog.cs
│ │ │ │ ├── TestAttributes.cs
│ │ │ │ ├── TestBase.cs
│ │ │ │ ├── TestInterface.cs
│ │ │ │ ├── TestResult.cs
│ │ │ │ ├── Test_Common.csproj
│ │ │ │ └── Utilities.cs
│ │ │ ├── CompileTime/
│ │ │ │ ├── CompilerTests/
│ │ │ │ │ ├── CompilerTests.csproj
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SimpleTests.cs
│ │ │ │ └── GenericInstantiationClosure/
│ │ │ │ ├── Fail_Field/
│ │ │ │ │ └── test.cs
│ │ │ │ ├── Fail_GenericMethod1/
│ │ │ │ │ └── test.cs
│ │ │ │ ├── Fail_GenericMethod2/
│ │ │ │ │ └── test.cs
│ │ │ │ ├── Fail_Inheritance/
│ │ │ │ │ └── test.cs
│ │ │ │ ├── Fail_Method/
│ │ │ │ │ └── test.cs
│ │ │ │ ├── Pass/
│ │ │ │ │ └── test.cs
│ │ │ │ └── rebuildDir.cmd
│ │ │ ├── Desktop/
│ │ │ │ └── Net/
│ │ │ │ ├── HttpTest/
│ │ │ │ │ ├── App.config
│ │ │ │ │ ├── HttpTest.csproj
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ └── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── NetworkTest/
│ │ │ │ ├── App.config
│ │ │ │ ├── NetworkTest.csproj
│ │ │ │ ├── Program.cs
│ │ │ │ └── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── HardwareTests/
│ │ │ │ ├── Gpio/
│ │ │ │ │ ├── GpioTest.csproj
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ └── ReadMe.txt
│ │ │ │ └── SerialPort/
│ │ │ │ ├── Program.cs
│ │ │ │ ├── ReadMe.txt
│ │ │ │ └── SerialPortTest.csproj
│ │ │ ├── LlilumTests.sln
│ │ │ ├── LlilumWin32/
│ │ │ │ ├── LlilumWin32.cpp
│ │ │ │ ├── LlilumWin32.vcxproj
│ │ │ │ ├── LlilumWin32.vcxproj.filters
│ │ │ │ ├── ReadMe.txt
│ │ │ │ ├── stdafx.cpp
│ │ │ │ ├── stdafx.h
│ │ │ │ └── targetver.h
│ │ │ ├── LlilumWin32.sln
│ │ │ ├── RunTime/
│ │ │ │ ├── NETMF/
│ │ │ │ │ ├── System/
│ │ │ │ │ │ ├── Http/
│ │ │ │ │ │ │ ├── AuthenticationTests.cs
│ │ │ │ │ │ │ ├── Base64Tests.cs
│ │ │ │ │ │ │ ├── FunctionalTests.cs
│ │ │ │ │ │ │ ├── HttpKnownHeaderNamesTests.cs
│ │ │ │ │ │ │ ├── HttpRequestHeaderTests.cs
│ │ │ │ │ │ │ ├── HttpResponseHeaderTests.cs
│ │ │ │ │ │ │ ├── HttpServer.cs
│ │ │ │ │ │ │ ├── HttpStatusCodeTests.cs
│ │ │ │ │ │ │ ├── HttpVersionTests.cs
│ │ │ │ │ │ │ ├── HttpWebRequestTests.cs
│ │ │ │ │ │ │ ├── HttpWebResponseTests.cs
│ │ │ │ │ │ │ ├── Master.cs
│ │ │ │ │ │ │ ├── ProtocolViolationExceptionTests.cs
│ │ │ │ │ │ │ ├── TestServer.cs
│ │ │ │ │ │ │ ├── UriTests.cs
│ │ │ │ │ │ │ ├── WebExceptionTests.cs
│ │ │ │ │ │ │ ├── WebHeaderCollectionTests.cs
│ │ │ │ │ │ │ ├── WebProxyTests.cs
│ │ │ │ │ │ │ ├── WebRequestTests.cs
│ │ │ │ │ │ │ └── WebResponseTests.cs
│ │ │ │ │ │ ├── IO/
│ │ │ │ │ │ │ └── MemoryStream/
│ │ │ │ │ │ │ ├── CanRead.cs
│ │ │ │ │ │ │ ├── CanSeek.cs
│ │ │ │ │ │ │ ├── CanWrite.cs
│ │ │ │ │ │ │ ├── Close.cs
│ │ │ │ │ │ │ ├── Flush.cs
│ │ │ │ │ │ │ ├── Length.cs
│ │ │ │ │ │ │ ├── MemoryStreamHelper.cs
│ │ │ │ │ │ │ ├── MemoryStream_Ctor.cs
│ │ │ │ │ │ │ ├── Position.cs
│ │ │ │ │ │ │ ├── Read.cs
│ │ │ │ │ │ │ ├── ReadByte.cs
│ │ │ │ │ │ │ ├── Seek.cs
│ │ │ │ │ │ │ ├── SetLength.cs
│ │ │ │ │ │ │ ├── ToArray.cs
│ │ │ │ │ │ │ ├── Write.cs
│ │ │ │ │ │ │ ├── WriteByte.cs
│ │ │ │ │ │ │ └── WriteTo.cs
│ │ │ │ │ │ ├── Test_System.csproj
│ │ │ │ │ │ ├── Text/
│ │ │ │ │ │ │ └── StringBuilder/
│ │ │ │ │ │ │ └── StringBuilderTests.cs
│ │ │ │ │ │ ├── netTests/
│ │ │ │ │ │ │ └── NetTests.cs
│ │ │ │ │ │ └── socketTests/
│ │ │ │ │ │ ├── SocketExceptionTests.cs
│ │ │ │ │ │ ├── SocketPair.cs
│ │ │ │ │ │ ├── SocketServer.cs
│ │ │ │ │ │ ├── SocketTests.cs
│ │ │ │ │ │ ├── SocketTools.cs
│ │ │ │ │ │ ├── SocketsEnumsTests.cs
│ │ │ │ │ │ └── StressTests.cs
│ │ │ │ │ └── mscorlib/
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── Test_mscorlib.csproj
│ │ │ │ │ ├── arrays/
│ │ │ │ │ │ ├── ArraysOtherTests.cs
│ │ │ │ │ │ └── ArraysSimpleTests.cs
│ │ │ │ │ ├── attributes/
│ │ │ │ │ │ ├── AttributesTests1.cs
│ │ │ │ │ │ └── AttributesTests2.cs
│ │ │ │ │ ├── basicconcepts/
│ │ │ │ │ │ └── BasicConceptTests.cs
│ │ │ │ │ ├── bitconverter/
│ │ │ │ │ │ ├── BitConverterTests.cs
│ │ │ │ │ │ ├── Helper.cs
│ │ │ │ │ │ └── TestFailException.cs
│ │ │ │ │ ├── classes/
│ │ │ │ │ │ ├── classes1/
│ │ │ │ │ │ │ ├── ConstTests.cs
│ │ │ │ │ │ │ ├── ConstructorsTests.cs
│ │ │ │ │ │ │ ├── DeclarationsTests.cs
│ │ │ │ │ │ │ ├── DestructorsTests.cs
│ │ │ │ │ │ │ ├── EventsTests.cs
│ │ │ │ │ │ │ └── FieldsTests.cs
│ │ │ │ │ │ ├── classes2/
│ │ │ │ │ │ │ ├── IndexersTests.cs
│ │ │ │ │ │ │ ├── OperatorsTests.cs
│ │ │ │ │ │ │ ├── PropertiesTests.cs
│ │ │ │ │ │ │ └── Static_InstTests.cs
│ │ │ │ │ │ └── classes3/
│ │ │ │ │ │ ├── MembersTests.cs
│ │ │ │ │ │ └── MethodsTests.cs
│ │ │ │ │ ├── collections/
│ │ │ │ │ │ ├── ArrayListTests.cs
│ │ │ │ │ │ ├── HashtableTests.cs
│ │ │ │ │ │ ├── QueueTests.cs
│ │ │ │ │ │ ├── StackTests.cs
│ │ │ │ │ │ └── TestObjects.cs
│ │ │ │ │ ├── conversions/
│ │ │ │ │ │ ├── BoxingTests.cs
│ │ │ │ │ │ ├── Convert.cs
│ │ │ │ │ │ ├── ExprefTests.cs
│ │ │ │ │ │ ├── ImpenumTests.cs
│ │ │ │ │ │ ├── ImprefTests.cs
│ │ │ │ │ │ ├── basic/
│ │ │ │ │ │ │ └── BasicTests.cs
│ │ │ │ │ │ ├── basic2/
│ │ │ │ │ │ │ └── BasicTests2.cs
│ │ │ │ │ │ ├── expenum/
│ │ │ │ │ │ │ ├── Expenum1Tests.cs
│ │ │ │ │ │ │ └── Expenum2Tests.cs
│ │ │ │ │ │ ├── expenum2/
│ │ │ │ │ │ │ └── Expenum3Tests.cs
│ │ │ │ │ │ └── user/
│ │ │ │ │ │ ├── ClassClassTests.cs
│ │ │ │ │ │ ├── ClassStructTests.cs
│ │ │ │ │ │ ├── StructClassTests.cs
│ │ │ │ │ │ ├── StructStructTests.cs
│ │ │ │ │ │ └── selection/
│ │ │ │ │ │ └── BasicSelectionTests.cs
│ │ │ │ │ ├── delegates/
│ │ │ │ │ │ └── DelegatesTests.cs
│ │ │ │ │ ├── enums/
│ │ │ │ │ │ └── EnumTests.cs
│ │ │ │ │ ├── exceptions/
│ │ │ │ │ │ └── CSharp/
│ │ │ │ │ │ └── ExceptionsTests.cs
│ │ │ │ │ ├── expressions/
│ │ │ │ │ │ ├── expressions1/
│ │ │ │ │ │ │ ├── ArithmeticTests1.cs
│ │ │ │ │ │ │ ├── ArithmeticTests2.cs
│ │ │ │ │ │ │ └── OtherTests1.cs
│ │ │ │ │ │ └── expressions2/
│ │ │ │ │ │ └── ExpressionsTests.cs
│ │ │ │ │ ├── interfaces/
│ │ │ │ │ │ └── InterfaceTests.cs
│ │ │ │ │ ├── lexical/
│ │ │ │ │ │ ├── LexicalTests1.cs
│ │ │ │ │ │ └── LexicalTests2.cs
│ │ │ │ │ ├── namespaces/
│ │ │ │ │ │ ├── NS_attribute_01.cs
│ │ │ │ │ │ ├── NS_attribute_02.cs
│ │ │ │ │ │ ├── NS_compunit_01A.cs
│ │ │ │ │ │ ├── NS_compunit_01B.cs
│ │ │ │ │ │ ├── NS_compunit_03A.cs
│ │ │ │ │ │ ├── NS_compunit_03B.cs
│ │ │ │ │ │ ├── NS_compunit_04A.cs
│ │ │ │ │ │ ├── NS_compunit_04B.cs
│ │ │ │ │ │ ├── NS_decl_14.cs
│ │ │ │ │ │ ├── NS_decl_15.cs
│ │ │ │ │ │ └── NamespacesTests.cs
│ │ │ │ │ ├── statements/
│ │ │ │ │ │ └── StatementsTests.cs
│ │ │ │ │ ├── structs/
│ │ │ │ │ │ └── StructsTests.cs
│ │ │ │ │ ├── systemlib/
│ │ │ │ │ │ ├── systemlib1/
│ │ │ │ │ │ │ ├── Guid.cs
│ │ │ │ │ │ │ ├── ParseTests.cs
│ │ │ │ │ │ │ ├── SystemTimeSpanTests.cs
│ │ │ │ │ │ │ └── SystemTimeZoneTests.cs
│ │ │ │ │ │ └── systemlib2/
│ │ │ │ │ │ ├── InitLocalsTests.cs
│ │ │ │ │ │ ├── MicrosoftSpotReflection.cs
│ │ │ │ │ │ ├── SystemAppDomainTests.cs
│ │ │ │ │ │ ├── SystemDateTimeTests.cs
│ │ │ │ │ │ ├── SystemGCTests.cs
│ │ │ │ │ │ ├── SystemMathTests.cs
│ │ │ │ │ │ ├── SystemReflectionAssembly.cs
│ │ │ │ │ │ ├── SystemReflectionMemberTests.cs
│ │ │ │ │ │ ├── SystemReflectionTypeTests.cs
│ │ │ │ │ │ ├── SystemStringTests.cs
│ │ │ │ │ │ ├── SystemTypeTests.cs
│ │ │ │ │ │ ├── SystemWeakReferenceTests.cs
│ │ │ │ │ │ └── Utf8EncodingTests.cs
│ │ │ │ │ ├── threads/
│ │ │ │ │ │ ├── threads1/
│ │ │ │ │ │ │ └── ThreadTests.cs
│ │ │ │ │ │ ├── threads2/
│ │ │ │ │ │ │ ├── AutoResetEventTests.cs
│ │ │ │ │ │ │ ├── InterlockedTests.cs
│ │ │ │ │ │ │ ├── MonitorTests.cs
│ │ │ │ │ │ │ ├── TimeoutTests.cs
│ │ │ │ │ │ │ └── WaitHandleTests.cs
│ │ │ │ │ │ └── threads3/
│ │ │ │ │ │ └── TimerTests.cs
│ │ │ │ │ ├── types/
│ │ │ │ │ │ ├── ReferenceBoxingTests.cs
│ │ │ │ │ │ ├── ValueArrayTests.cs
│ │ │ │ │ │ ├── ValueDefault_ConstTests.cs
│ │ │ │ │ │ ├── ValueFloatTests.cs
│ │ │ │ │ │ ├── ValueIntegralTests.cs
│ │ │ │ │ │ ├── ValueSimpleTests.cs
│ │ │ │ │ │ └── ValueTests.cs
│ │ │ │ │ └── variables/
│ │ │ │ │ ├── CategoriesTests.cs
│ │ │ │ │ └── VariablesTests.cs
│ │ │ │ └── mscorlib_UnitTest/
│ │ │ │ ├── Files.Designer.cs
│ │ │ │ ├── Files.resx
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── Resources/
│ │ │ │ │ └── ZeligRefreshBinaryDrop.cmd
│ │ │ │ ├── Test_OpenClasses.cs
│ │ │ │ ├── Verify.cs
│ │ │ │ ├── app.config
│ │ │ │ └── mscorlib_UnitTest.csproj
│ │ │ ├── Runner/
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── TestRunner.cs
│ │ │ │ └── TestRunner.csproj
│ │ │ └── mbed/
│ │ │ ├── NativeHelpers/
│ │ │ │ ├── NativeHelpers.vcxproj
│ │ │ │ └── NativeHelpers.vcxproj.filters
│ │ │ ├── SimpleHttp/
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── SimpleHttp.csproj
│ │ │ ├── SimpleNet/
│ │ │ │ ├── Program.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ └── SimpleNet.csproj
│ │ │ ├── SimpleSDK/
│ │ │ │ ├── Managed/
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ └── SimpleTestProgram.csproj
│ │ │ │ └── Native/
│ │ │ │ ├── Native.vcxproj
│ │ │ │ ├── helpers.h
│ │ │ │ ├── mbed_simple_K64F.FrontEndConfig
│ │ │ │ ├── mbed_simple_LPC1768.FrontEndConfig
│ │ │ │ └── pch.h
│ │ │ └── simple/
│ │ │ ├── LedToggler.cs
│ │ │ ├── Program.cs
│ │ │ ├── Program_Test__ADC.cs
│ │ │ ├── Program_Test__GpioInterruptTestData.cs
│ │ │ ├── Program_Test__GpioPerf.cs
│ │ │ ├── Program_Test__I2C.cs
│ │ │ ├── Program_Test__PWM.cs
│ │ │ ├── Program_Test__SPI.cs
│ │ │ ├── Program_Test__SpiLcd.cs
│ │ │ ├── Program_Test__Win32.cs
│ │ │ ├── Properties/
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── SpiLcdC12832.cs
│ │ │ └── simple.csproj
│ │ ├── Zelig.proj
│ │ ├── Zelig.sln
│ │ └── setenv.cmd
│ ├── ZeligInterop/
│ │ └── Sample/
│ │ ├── ExternalLinking_tester/
│ │ │ ├── dotNetMF.proj
│ │ │ ├── zelig_interop.cpp
│ │ │ ├── zelig_interop.h
│ │ │ └── zelig_interop2.cpp
│ │ ├── FileSystemSampleLPC/
│ │ │ ├── BlockStorageFileSystem.cpp
│ │ │ ├── BlockStorageFileSystem.h
│ │ │ ├── LIB/
│ │ │ │ ├── FS_FAT.lib
│ │ │ │ ├── Watchdog_pal_stubs.lib
│ │ │ │ ├── blockstorage_pal.lib
│ │ │ │ ├── cpu_power_stubs.lib
│ │ │ │ ├── fs_pal.lib
│ │ │ │ └── tinycrt_pal.lib
│ │ │ ├── build.cmd
│ │ │ └── dotnetmf.proj
│ │ └── FileSystemTest/
│ │ ├── BlockStorageFileSystem.cpp
│ │ ├── BlockStorageFileSystem.h
│ │ ├── LIB/
│ │ │ ├── FS_FAT.lib
│ │ │ ├── Watchdog_pal_stubs.lib
│ │ │ ├── blockstorage_pal.lib
│ │ │ ├── cpu_power_stubs.lib
│ │ │ ├── fs_pal.lib
│ │ │ └── tinycrt_pal.lib
│ │ ├── build.cmd
│ │ └── dotnetmf.proj
│ ├── ext-tools/
│ │ └── binutils/
│ │ └── binutils.sln
│ ├── lwip/
│ │ ├── lwip/
│ │ │ ├── include/
│ │ │ │ ├── ipv4/
│ │ │ │ │ └── lwip/
│ │ │ │ │ ├── autoip.h
│ │ │ │ │ ├── icmp.h
│ │ │ │ │ ├── igmp.h
│ │ │ │ │ ├── inet.h
│ │ │ │ │ ├── inet_chksum.h
│ │ │ │ │ ├── ip.h
│ │ │ │ │ ├── ip_addr.h
│ │ │ │ │ └── ip_frag.h
│ │ │ │ ├── lwip/
│ │ │ │ │ ├── api.h
│ │ │ │ │ ├── api_msg.h
│ │ │ │ │ ├── arch.h
│ │ │ │ │ ├── debug.h
│ │ │ │ │ ├── def.h
│ │ │ │ │ ├── dhcp.h
│ │ │ │ │ ├── dns.h
│ │ │ │ │ ├── err.h
│ │ │ │ │ ├── init.h
│ │ │ │ │ ├── mem.h
│ │ │ │ │ ├── memp.h
│ │ │ │ │ ├── memp_std.h
│ │ │ │ │ ├── netbuf.h
│ │ │ │ │ ├── netdb.h
│ │ │ │ │ ├── netif.h
│ │ │ │ │ ├── netifapi.h
│ │ │ │ │ ├── opt.h
│ │ │ │ │ ├── pbuf.h
│ │ │ │ │ ├── raw.h
│ │ │ │ │ ├── sio.h
│ │ │ │ │ ├── snmp.h
│ │ │ │ │ ├── snmp_asn1.h
│ │ │ │ │ ├── snmp_msg.h
│ │ │ │ │ ├── snmp_structs.h
│ │ │ │ │ ├── sockets.h
│ │ │ │ │ ├── stats.h
│ │ │ │ │ ├── sys.h
│ │ │ │ │ ├── tcp.h
│ │ │ │ │ ├── tcp_impl.h
│ │ │ │ │ ├── tcpip.h
│ │ │ │ │ ├── timers.h
│ │ │ │ │ └── udp.h
│ │ │ │ └── netif/
│ │ │ │ ├── etharp.h
│ │ │ │ ├── ppp_oe.h
│ │ │ │ └── slipif.h
│ │ │ ├── lib/
│ │ │ │ ├── liblwIP.a
│ │ │ │ ├── liblwIPc.a
│ │ │ │ └── liblwIPd.a
│ │ │ └── lwipopts.h
│ │ ├── lwip-eth/
│ │ │ └── arch/
│ │ │ ├── TARGET_Freescale/
│ │ │ │ ├── k64f_emac_config.h
│ │ │ │ └── lwipopts_conf.h
│ │ │ ├── TARGET_NXP/
│ │ │ │ ├── lpc17_emac.c
│ │ │ │ ├── lpc17xx_emac.h
│ │ │ │ ├── lpc_emac_config.h
│ │ │ │ ├── lpc_phy.h
│ │ │ │ ├── lpc_phy_dp83848.c
│ │ │ │ └── lwipopts_conf.h
│ │ │ ├── TARGET_RZ_A1H/
│ │ │ │ ├── lwipopts_conf.h
│ │ │ │ └── rza1_emac.c
│ │ │ └── TARGET_STM/
│ │ │ ├── lwipopts_conf.h
│ │ │ └── stm32f4_emac.c
│ │ └── lwip-sys/
│ │ └── arch/
│ │ ├── cc.h
│ │ ├── checksum.c
│ │ ├── memcpy.c
│ │ ├── perf.h
│ │ ├── sys_arch.c
│ │ └── sys_arch.h
│ ├── mbed/
│ │ ├── AnalogIn.h
│ │ ├── AnalogOut.h
│ │ ├── BusIn.h
│ │ ├── BusInOut.h
│ │ ├── BusOut.h
│ │ ├── CAN.h
│ │ ├── CThunk.h
│ │ ├── CallChain.h
│ │ ├── CircularBuffer.h
│ │ ├── DigitalIn.h
│ │ ├── DigitalInOut.h
│ │ ├── DigitalOut.h
│ │ ├── DirHandle.h
│ │ ├── Ethernet.h
│ │ ├── EthernetInterface/
│ │ │ ├── EthernetInterface.cpp
│ │ │ ├── EthernetInterface.h
│ │ │ ├── README.txt
│ │ │ └── eth_arch.h
│ │ ├── FileBase.h
│ │ ├── FileHandle.h
│ │ ├── FileLike.h
│ │ ├── FilePath.h
│ │ ├── FileSystemLike.h
│ │ ├── FunctionPointer.h
│ │ ├── I2C.h
│ │ ├── I2CSlave.h
│ │ ├── InterruptIn.h
│ │ ├── InterruptManager.h
│ │ ├── LocalFileSystem.h
│ │ ├── LowPowerTicker.h
│ │ ├── LowPowerTimeout.h
│ │ ├── LowPowerTimer.h
│ │ ├── PortIn.h
│ │ ├── PortInOut.h
│ │ ├── PortOut.h
│ │ ├── PwmOut.h
│ │ ├── RawSerial.h
│ │ ├── SPI.h
│ │ ├── SPISlave.h
│ │ ├── Serial.h
│ │ ├── SerialBase.h
│ │ ├── Stream.h
│ │ ├── TARGET_K64F/
│ │ │ ├── MK64F12.h
│ │ │ ├── TARGET_Freescale/
│ │ │ │ └── TARGET_KPSDK_MCUS/
│ │ │ │ ├── PeripheralPins.h
│ │ │ │ ├── PortNames.h
│ │ │ │ ├── TARGET_KPSDK_CODE/
│ │ │ │ │ ├── common/
│ │ │ │ │ │ └── phyksz8081/
│ │ │ │ │ │ └── fsl_phy_driver.h
│ │ │ │ │ ├── drivers/
│ │ │ │ │ │ ├── clock/
│ │ │ │ │ │ │ └── fsl_clock_manager.h
│ │ │ │ │ │ ├── enet/
│ │ │ │ │ │ │ ├── fsl_enet_driver.h
│ │ │ │ │ │ │ └── fsl_enet_rtcs_adapter.h
│ │ │ │ │ │ ├── interrupt/
│ │ │ │ │ │ │ ├── fsl_interrupt_features.h
│ │ │ │ │ │ │ └── fsl_interrupt_manager.h
│ │ │ │ │ │ └── pit/
│ │ │ │ │ │ ├── common/
│ │ │ │ │ │ │ └── fsl_pit_common.h
│ │ │ │ │ │ └── fsl_pit_driver.h
│ │ │ │ │ ├── hal/
│ │ │ │ │ │ ├── adc/
│ │ │ │ │ │ │ ├── fsl_adc_features.h
│ │ │ │ │ │ │ └── fsl_adc_hal.h
│ │ │ │ │ │ ├── can/
│ │ │ │ │ │ │ ├── fsl_flexcan_features.h
│ │ │ │ │ │ │ └── fsl_flexcan_hal.h
│ │ │ │ │ │ ├── dac/
│ │ │ │ │ │ │ ├── fsl_dac_features.h
│ │ │ │ │ │ │ └── fsl_dac_hal.h
│ │ │ │ │ │ ├── dmamux/
│ │ │ │ │ │ │ ├── fsl_dmamux_features.h
│ │ │ │ │ │ │ └── fsl_dmamux_hal.h
│ │ │ │ │ │ ├── dspi/
│ │ │ │ │ │ │ ├── fsl_dspi_features.h
│ │ │ │ │ │ │ └── fsl_dspi_hal.h
│ │ │ │ │ │ ├── edma/
│ │ │ │ │ │ │ ├── fsl_edma_features.h
│ │ │ │ │ │ │ └── fsl_edma_hal.h
│ │ │ │ │ │ ├── enet/
│ │ │ │ │ │ │ ├── fsl_enet_features.h
│ │ │ │ │ │ │ └── fsl_enet_hal.h
│ │ │ │ │ │ ├── flextimer/
│ │ │ │ │ │ │ ├── fsl_ftm_features.h
│ │ │ │ │ │ │ └── fsl_ftm_hal.h
│ │ │ │ │ │ ├── gpio/
│ │ │ │ │ │ │ ├── fsl_gpio_features.h
│ │ │ │ │ │ │ └── fsl_gpio_hal.h
│ │ │ │ │ │ ├── i2c/
│ │ │ │ │ │ │ ├── fsl_i2c_features.h
│ │ │ │ │ │ │ └── fsl_i2c_hal.h
│ │ │ │ │ │ ├── llwu/
│ │ │ │ │ │ │ ├── fsl_llwu_features.h
│ │ │ │ │ │ │ └── fsl_llwu_hal.h
│ │ │ │ │ │ ├── lptmr/
│ │ │ │ │ │ │ ├── fsl_lptmr_features.h
│ │ │ │ │ │ │ └── fsl_lptmr_hal.h
│ │ │ │ │ │ ├── lpuart/
│ │ │ │ │ │ │ ├── fsl_lpuart_features.h
│ │ │ │ │ │ │ └── fsl_lpuart_hal.h
│ │ │ │ │ │ ├── mcg/
│ │ │ │ │ │ │ ├── fsl_mcg_features.h
│ │ │ │ │ │ │ ├── fsl_mcg_hal.h
│ │ │ │ │ │ │ └── fsl_mcg_hal_modes.h
│ │ │ │ │ │ ├── mpu/
│ │ │ │ │ │ │ ├── fsl_mpu_features.h
│ │ │ │ │ │ │ └── fsl_mpu_hal.h
│ │ │ │ │ │ ├── osc/
│ │ │ │ │ │ │ ├── fsl_osc_features.h
│ │ │ │ │ │ │ └── fsl_osc_hal.h
│ │ │ │ │ │ ├── pdb/
│ │ │ │ │ │ │ ├── fsl_pdb_features.h
│ │ │ │ │ │ │ └── fsl_pdb_hal.h
│ │ │ │ │ │ ├── pit/
│ │ │ │ │ │ │ ├── fsl_pit_features.h
│ │ │ │ │ │ │ └── fsl_pit_hal.h
│ │ │ │ │ │ ├── pmc/
│ │ │ │ │ │ │ ├── fsl_pmc_features.h
│ │ │ │ │ │ │ └── fsl_pmc_hal.h
│ │ │ │ │ │ ├── port/
│ │ │ │ │ │ │ ├── fsl_port_features.h
│ │ │ │ │ │ │ └── fsl_port_hal.h
│ │ │ │ │ │ ├── rcm/
│ │ │ │ │ │ │ ├── fsl_rcm_features.h
│ │ │ │ │ │ │ └── fsl_rcm_hal.h
│ │ │ │ │ │ ├── rtc/
│ │ │ │ │ │ │ ├── fsl_rtc_features.h
│ │ │ │ │ │ │ └── fsl_rtc_hal.h
│ │ │ │ │ │ ├── sai/
│ │ │ │ │ │ │ ├── fsl_sai_features.h
│ │ │ │ │ │ │ └── fsl_sai_hal.h
│ │ │ │ │ │ ├── sdhc/
│ │ │ │ │ │ │ ├── fsl_sdhc_features.h
│ │ │ │ │ │ │ └── fsl_sdhc_hal.h
│ │ │ │ │ │ ├── sim/
│ │ │ │ │ │ │ ├── fsl_sim_features.h
│ │ │ │ │ │ │ └── fsl_sim_hal.h
│ │ │ │ │ │ ├── smc/
│ │ │ │ │ │ │ ├── fsl_smc_features.h
│ │ │ │ │ │ │ └── fsl_smc_hal.h
│ │ │ │ │ │ ├── uart/
│ │ │ │ │ │ │ ├── fsl_uart_features.h
│ │ │ │ │ │ │ └── fsl_uart_hal.h
│ │ │ │ │ │ └── wdog/
│ │ │ │ │ │ ├── fsl_wdog_features.h
│ │ │ │ │ │ └── fsl_wdog_hal.h
│ │ │ │ │ └── utilities/
│ │ │ │ │ ├── fsl_misc_utilities.h
│ │ │ │ │ ├── fsl_os_abstraction.h
│ │ │ │ │ ├── fsl_os_abstraction_mbed.h
│ │ │ │ │ └── sw_timer.h
│ │ │ │ ├── TARGET_MCU_K64F/
│ │ │ │ │ ├── MK64F12/
│ │ │ │ │ │ ├── fsl_clock_K64F12.h
│ │ │ │ │ │ └── fsl_sim_hal_K64F12.h
│ │ │ │ │ ├── TARGET_FRDM/
│ │ │ │ │ │ ├── PeripheralNames.h
│ │ │ │ │ │ ├── PinNames.h
│ │ │ │ │ │ ├── crc.h
│ │ │ │ │ │ └── device.h
│ │ │ │ │ └── device/
│ │ │ │ │ ├── MK64F12/
│ │ │ │ │ │ └── fsl_bitaccess.h
│ │ │ │ │ └── device/
│ │ │ │ │ ├── MK64F12/
│ │ │ │ │ │ ├── MK64F12.h
│ │ │ │ │ │ ├── MK64F12_adc.h
│ │ │ │ │ │ ├── MK64F12_aips.h
│ │ │ │ │ │ ├── MK64F12_axbs.h
│ │ │ │ │ │ ├── MK64F12_can.h
│ │ │ │ │ │ ├── MK64F12_cau.h
│ │ │ │ │ │ ├── MK64F12_cmp.h
│ │ │ │ │ │ ├── MK64F12_cmt.h
│ │ │ │ │ │ ├── MK64F12_crc.h
│ │ │ │ │ │ ├── MK64F12_dac.h
│ │ │ │ │ │ ├── MK64F12_dma.h
│ │ │ │ │ │ ├── MK64F12_dmamux.h
│ │ │ │ │ │ ├── MK64F12_enet.h
│ │ │ │ │ │ ├── MK64F12_ewm.h
│ │ │ │ │ │ ├── MK64F12_fb.h
│ │ │ │ │ │ ├── MK64F12_fmc.h
│ │ │ │ │ │ ├── MK64F12_ftfe.h
│ │ │ │ │ │ ├── MK64F12_ftm.h
│ │ │ │ │ │ ├── MK64F12_gpio.h
│ │ │ │ │ │ ├── MK64F12_i2c.h
│ │ │ │ │ │ ├── MK64F12_i2s.h
│ │ │ │ │ │ ├── MK64F12_llwu.h
│ │ │ │ │ │ ├── MK64F12_lptmr.h
│ │ │ │ │ │ ├── MK64F12_mcg.h
│ │ │ │ │ │ ├── MK64F12_mcm.h
│ │ │ │ │ │ ├── MK64F12_mpu.h
│ │ │ │ │ │ ├── MK64F12_nv.h
│ │ │ │ │ │ ├── MK64F12_osc.h
│ │ │ │ │ │ ├── MK64F12_pdb.h
│ │ │ │ │ │ ├── MK64F12_pit.h
│ │ │ │ │ │ ├── MK64F12_pmc.h
│ │ │ │ │ │ ├── MK64F12_port.h
│ │ │ │ │ │ ├── MK64F12_rcm.h
│ │ │ │ │ │ ├── MK64F12_rfsys.h
│ │ │ │ │ │ ├── MK64F12_rfvbat.h
│ │ │ │ │ │ ├── MK64F12_rng.h
│ │ │ │ │ │ ├── MK64F12_rtc.h
│ │ │ │ │ │ ├── MK64F12_sdhc.h
│ │ │ │ │ │ ├── MK64F12_sim.h
│ │ │ │ │ │ ├── MK64F12_smc.h
│ │ │ │ │ │ ├── MK64F12_spi.h
│ │ │ │ │ │ ├── MK64F12_uart.h
│ │ │ │ │ │ ├── MK64F12_usb.h
│ │ │ │ │ │ ├── MK64F12_usbdcd.h
│ │ │ │ │ │ ├── MK64F12_vref.h
│ │ │ │ │ │ └── MK64F12_wdog.h
│ │ │ │ │ └── fsl_device_registers.h
│ │ │ │ ├── gpio_object.h
│ │ │ │ └── objects.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── K64FN1M0xxx12.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── liblwIPeth.a
│ │ │ │ ├── liblwipsysarch.a
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── libmbedeth.a
│ │ │ │ ├── mbed_overrides.o
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_MK64F12.o
│ │ │ │ └── system_MK64F12.o
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ └── system_MK64F12.h
│ │ ├── TARGET_LPC1768/
│ │ │ ├── LPC17xx.h
│ │ │ ├── TARGET_NXP/
│ │ │ │ └── TARGET_LPC176X/
│ │ │ │ ├── PeripheralNames.h
│ │ │ │ ├── PortNames.h
│ │ │ │ ├── TARGET_MBED_LPC1768/
│ │ │ │ │ ├── PinNames.h
│ │ │ │ │ ├── device.h
│ │ │ │ │ └── reserved_pins.h
│ │ │ │ ├── gpio_object.h
│ │ │ │ └── objects.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── LPC1768.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── libmbedeth.a
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_LPC17xx.o
│ │ │ │ └── system_LPC17xx.o
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ └── system_LPC17xx.h
│ │ ├── TARGET_NUCLEO_F091RC/
│ │ │ ├── TARGET_STM/
│ │ │ │ └── TARGET_STM32F0/
│ │ │ │ ├── PeripheralPins.h
│ │ │ │ ├── TARGET_NUCLEO_F091RC/
│ │ │ │ │ ├── PeripheralNames.h
│ │ │ │ │ ├── PinNames.h
│ │ │ │ │ ├── PortNames.h
│ │ │ │ │ ├── device.h
│ │ │ │ │ └── objects.h
│ │ │ │ └── gpio_object.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── STM32F091XC.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── hal_tick.o
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── mbed_overrides.o
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_stm32f091xc.o
│ │ │ │ ├── stm32f0xx_hal.o
│ │ │ │ ├── stm32f0xx_hal_adc.o
│ │ │ │ ├── stm32f0xx_hal_adc_ex.o
│ │ │ │ ├── stm32f0xx_hal_can.o
│ │ │ │ ├── stm32f0xx_hal_cec.o
│ │ │ │ ├── stm32f0xx_hal_comp.o
│ │ │ │ ├── stm32f0xx_hal_cortex.o
│ │ │ │ ├── stm32f0xx_hal_crc.o
│ │ │ │ ├── stm32f0xx_hal_crc_ex.o
│ │ │ │ ├── stm32f0xx_hal_dac.o
│ │ │ │ ├── stm32f0xx_hal_dac_ex.o
│ │ │ │ ├── stm32f0xx_hal_dma.o
│ │ │ │ ├── stm32f0xx_hal_flash.o
│ │ │ │ ├── stm32f0xx_hal_flash_ex.o
│ │ │ │ ├── stm32f0xx_hal_gpio.o
│ │ │ │ ├── stm32f0xx_hal_i2c.o
│ │ │ │ ├── stm32f0xx_hal_i2c_ex.o
│ │ │ │ ├── stm32f0xx_hal_i2s.o
│ │ │ │ ├── stm32f0xx_hal_irda.o
│ │ │ │ ├── stm32f0xx_hal_iwdg.o
│ │ │ │ ├── stm32f0xx_hal_pcd.o
│ │ │ │ ├── stm32f0xx_hal_pcd_ex.o
│ │ │ │ ├── stm32f0xx_hal_pwr.o
│ │ │ │ ├── stm32f0xx_hal_pwr_ex.o
│ │ │ │ ├── stm32f0xx_hal_rcc.o
│ │ │ │ ├── stm32f0xx_hal_rcc_ex.o
│ │ │ │ ├── stm32f0xx_hal_rtc.o
│ │ │ │ ├── stm32f0xx_hal_rtc_ex.o
│ │ │ │ ├── stm32f0xx_hal_smartcard.o
│ │ │ │ ├── stm32f0xx_hal_smartcard_ex.o
│ │ │ │ ├── stm32f0xx_hal_smbus.o
│ │ │ │ ├── stm32f0xx_hal_spi.o
│ │ │ │ ├── stm32f0xx_hal_spi_ex.o
│ │ │ │ ├── stm32f0xx_hal_tim.o
│ │ │ │ ├── stm32f0xx_hal_tim_ex.o
│ │ │ │ ├── stm32f0xx_hal_tsc.o
│ │ │ │ ├── stm32f0xx_hal_uart.o
│ │ │ │ ├── stm32f0xx_hal_uart_ex.o
│ │ │ │ ├── stm32f0xx_hal_usart.o
│ │ │ │ ├── stm32f0xx_hal_wwdg.o
│ │ │ │ └── system_stm32f0xx.o
│ │ │ ├── arm_common_tables.h
│ │ │ ├── arm_const_structs.h
│ │ │ ├── arm_math.h
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── hal_tick.h
│ │ │ ├── stm32_hal_legacy.h
│ │ │ ├── stm32f091xc.h
│ │ │ ├── stm32f0xx.h
│ │ │ ├── stm32f0xx_hal.h
│ │ │ ├── stm32f0xx_hal_adc.h
│ │ │ ├── stm32f0xx_hal_adc_ex.h
│ │ │ ├── stm32f0xx_hal_can.h
│ │ │ ├── stm32f0xx_hal_cec.h
│ │ │ ├── stm32f0xx_hal_comp.h
│ │ │ ├── stm32f0xx_hal_conf.h
│ │ │ ├── stm32f0xx_hal_cortex.h
│ │ │ ├── stm32f0xx_hal_crc.h
│ │ │ ├── stm32f0xx_hal_crc_ex.h
│ │ │ ├── stm32f0xx_hal_dac.h
│ │ │ ├── stm32f0xx_hal_dac_ex.h
│ │ │ ├── stm32f0xx_hal_def.h
│ │ │ ├── stm32f0xx_hal_dma.h
│ │ │ ├── stm32f0xx_hal_dma_ex.h
│ │ │ ├── stm32f0xx_hal_flash.h
│ │ │ ├── stm32f0xx_hal_flash_ex.h
│ │ │ ├── stm32f0xx_hal_gpio.h
│ │ │ ├── stm32f0xx_hal_gpio_ex.h
│ │ │ ├── stm32f0xx_hal_i2c.h
│ │ │ ├── stm32f0xx_hal_i2c_ex.h
│ │ │ ├── stm32f0xx_hal_i2s.h
│ │ │ ├── stm32f0xx_hal_irda.h
│ │ │ ├── stm32f0xx_hal_irda_ex.h
│ │ │ ├── stm32f0xx_hal_iwdg.h
│ │ │ ├── stm32f0xx_hal_pcd.h
│ │ │ ├── stm32f0xx_hal_pcd_ex.h
│ │ │ ├── stm32f0xx_hal_pwr.h
│ │ │ ├── stm32f0xx_hal_pwr_ex.h
│ │ │ ├── stm32f0xx_hal_rcc.h
│ │ │ ├── stm32f0xx_hal_rcc_ex.h
│ │ │ ├── stm32f0xx_hal_rtc.h
│ │ │ ├── stm32f0xx_hal_rtc_ex.h
│ │ │ ├── stm32f0xx_hal_smartcard.h
│ │ │ ├── stm32f0xx_hal_smartcard_ex.h
│ │ │ ├── stm32f0xx_hal_smbus.h
│ │ │ ├── stm32f0xx_hal_spi.h
│ │ │ ├── stm32f0xx_hal_spi_ex.h
│ │ │ ├── stm32f0xx_hal_tim.h
│ │ │ ├── stm32f0xx_hal_tim_ex.h
│ │ │ ├── stm32f0xx_hal_tsc.h
│ │ │ ├── stm32f0xx_hal_uart.h
│ │ │ ├── stm32f0xx_hal_uart_ex.h
│ │ │ ├── stm32f0xx_hal_usart.h
│ │ │ ├── stm32f0xx_hal_usart_ex.h
│ │ │ ├── stm32f0xx_hal_wwdg.h
│ │ │ └── system_stm32f0xx.h
│ │ ├── TARGET_NUCLEO_F401RE/
│ │ │ ├── TARGET_STM/
│ │ │ │ └── TARGET_STM32F4/
│ │ │ │ ├── PeripheralPins.h
│ │ │ │ ├── TARGET_NUCLEO_F401RE/
│ │ │ │ │ ├── PeripheralNames.h
│ │ │ │ │ ├── PinNames.h
│ │ │ │ │ ├── PortNames.h
│ │ │ │ │ ├── device.h
│ │ │ │ │ └── objects.h
│ │ │ │ └── gpio_object.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── STM32F401XE.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── hal_tick.o
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── mbed_overrides.o
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_stm32f401xe.o
│ │ │ │ ├── stm32f4xx_hal.o
│ │ │ │ ├── stm32f4xx_hal_adc.o
│ │ │ │ ├── stm32f4xx_hal_adc_ex.o
│ │ │ │ ├── stm32f4xx_hal_can.o
│ │ │ │ ├── stm32f4xx_hal_cec.o
│ │ │ │ ├── stm32f4xx_hal_cortex.o
│ │ │ │ ├── stm32f4xx_hal_crc.o
│ │ │ │ ├── stm32f4xx_hal_cryp.o
│ │ │ │ ├── stm32f4xx_hal_cryp_ex.o
│ │ │ │ ├── stm32f4xx_hal_dac.o
│ │ │ │ ├── stm32f4xx_hal_dac_ex.o
│ │ │ │ ├── stm32f4xx_hal_dcmi.o
│ │ │ │ ├── stm32f4xx_hal_dcmi_ex.o
│ │ │ │ ├── stm32f4xx_hal_dma.o
│ │ │ │ ├── stm32f4xx_hal_dma2d.o
│ │ │ │ ├── stm32f4xx_hal_dma_ex.o
│ │ │ │ ├── stm32f4xx_hal_dsi.o
│ │ │ │ ├── stm32f4xx_hal_eth.o
│ │ │ │ ├── stm32f4xx_hal_flash.o
│ │ │ │ ├── stm32f4xx_hal_flash_ex.o
│ │ │ │ ├── stm32f4xx_hal_flash_ramfunc.o
│ │ │ │ ├── stm32f4xx_hal_fmpi2c.o
│ │ │ │ ├── stm32f4xx_hal_fmpi2c_ex.o
│ │ │ │ ├── stm32f4xx_hal_gpio.o
│ │ │ │ ├── stm32f4xx_hal_hash.o
│ │ │ │ ├── stm32f4xx_hal_hash_ex.o
│ │ │ │ ├── stm32f4xx_hal_hcd.o
│ │ │ │ ├── stm32f4xx_hal_i2c.o
│ │ │ │ ├── stm32f4xx_hal_i2c_ex.o
│ │ │ │ ├── stm32f4xx_hal_i2s.o
│ │ │ │ ├── stm32f4xx_hal_i2s_ex.o
│ │ │ │ ├── stm32f4xx_hal_irda.o
│ │ │ │ ├── stm32f4xx_hal_iwdg.o
│ │ │ │ ├── stm32f4xx_hal_lptim.o
│ │ │ │ ├── stm32f4xx_hal_ltdc.o
│ │ │ │ ├── stm32f4xx_hal_ltdc_ex.o
│ │ │ │ ├── stm32f4xx_hal_msp_template.o
│ │ │ │ ├── stm32f4xx_hal_nand.o
│ │ │ │ ├── stm32f4xx_hal_nor.o
│ │ │ │ ├── stm32f4xx_hal_pccard.o
│ │ │ │ ├── stm32f4xx_hal_pcd.o
│ │ │ │ ├── stm32f4xx_hal_pcd_ex.o
│ │ │ │ ├── stm32f4xx_hal_pwr.o
│ │ │ │ ├── stm32f4xx_hal_pwr_ex.o
│ │ │ │ ├── stm32f4xx_hal_qspi.o
│ │ │ │ ├── stm32f4xx_hal_rcc.o
│ │ │ │ ├── stm32f4xx_hal_rcc_ex.o
│ │ │ │ ├── stm32f4xx_hal_rng.o
│ │ │ │ ├── stm32f4xx_hal_rtc.o
│ │ │ │ ├── stm32f4xx_hal_rtc_ex.o
│ │ │ │ ├── stm32f4xx_hal_sai.o
│ │ │ │ ├── stm32f4xx_hal_sai_ex.o
│ │ │ │ ├── stm32f4xx_hal_sd.o
│ │ │ │ ├── stm32f4xx_hal_sdram.o
│ │ │ │ ├── stm32f4xx_hal_smartcard.o
│ │ │ │ ├── stm32f4xx_hal_spdifrx.o
│ │ │ │ ├── stm32f4xx_hal_spi.o
│ │ │ │ ├── stm32f4xx_hal_sram.o
│ │ │ │ ├── stm32f4xx_hal_tim.o
│ │ │ │ ├── stm32f4xx_hal_tim_ex.o
│ │ │ │ ├── stm32f4xx_hal_uart.o
│ │ │ │ ├── stm32f4xx_hal_usart.o
│ │ │ │ ├── stm32f4xx_hal_wwdg.o
│ │ │ │ ├── stm32f4xx_ll_fmc.o
│ │ │ │ ├── stm32f4xx_ll_fsmc.o
│ │ │ │ ├── stm32f4xx_ll_sdmmc.o
│ │ │ │ ├── stm32f4xx_ll_usb.o
│ │ │ │ └── system_stm32f4xx.o
│ │ │ ├── arm_common_tables.h
│ │ │ ├── arm_const_structs.h
│ │ │ ├── arm_math.h
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── hal_tick.h
│ │ │ ├── stm32_hal_legacy.h
│ │ │ ├── stm32f401xe.h
│ │ │ ├── stm32f4xx.h
│ │ │ ├── stm32f4xx_hal.h
│ │ │ ├── stm32f4xx_hal_adc.h
│ │ │ ├── stm32f4xx_hal_adc_ex.h
│ │ │ ├── stm32f4xx_hal_can.h
│ │ │ ├── stm32f4xx_hal_cec.h
│ │ │ ├── stm32f4xx_hal_conf.h
│ │ │ ├── stm32f4xx_hal_conf_template.h
│ │ │ ├── stm32f4xx_hal_cortex.h
│ │ │ ├── stm32f4xx_hal_crc.h
│ │ │ ├── stm32f4xx_hal_cryp.h
│ │ │ ├── stm32f4xx_hal_cryp_ex.h
│ │ │ ├── stm32f4xx_hal_dac.h
│ │ │ ├── stm32f4xx_hal_dac_ex.h
│ │ │ ├── stm32f4xx_hal_dcmi.h
│ │ │ ├── stm32f4xx_hal_dcmi_ex.h
│ │ │ ├── stm32f4xx_hal_def.h
│ │ │ ├── stm32f4xx_hal_dma.h
│ │ │ ├── stm32f4xx_hal_dma2d.h
│ │ │ ├── stm32f4xx_hal_dma_ex.h
│ │ │ ├── stm32f4xx_hal_dsi.h
│ │ │ ├── stm32f4xx_hal_eth.h
│ │ │ ├── stm32f4xx_hal_flash.h
│ │ │ ├── stm32f4xx_hal_flash_ex.h
│ │ │ ├── stm32f4xx_hal_flash_ramfunc.h
│ │ │ ├── stm32f4xx_hal_fmpi2c.h
│ │ │ ├── stm32f4xx_hal_fmpi2c_ex.h
│ │ │ ├── stm32f4xx_hal_gpio.h
│ │ │ ├── stm32f4xx_hal_gpio_ex.h
│ │ │ ├── stm32f4xx_hal_hash.h
│ │ │ ├── stm32f4xx_hal_hash_ex.h
│ │ │ ├── stm32f4xx_hal_hcd.h
│ │ │ ├── stm32f4xx_hal_i2c.h
│ │ │ ├── stm32f4xx_hal_i2c_ex.h
│ │ │ ├── stm32f4xx_hal_i2s.h
│ │ │ ├── stm32f4xx_hal_i2s_ex.h
│ │ │ ├── stm32f4xx_hal_irda.h
│ │ │ ├── stm32f4xx_hal_iwdg.h
│ │ │ ├── stm32f4xx_hal_lptim.h
│ │ │ ├── stm32f4xx_hal_ltdc.h
│ │ │ ├── stm32f4xx_hal_ltdc_ex.h
│ │ │ ├── stm32f4xx_hal_nand.h
│ │ │ ├── stm32f4xx_hal_nor.h
│ │ │ ├── stm32f4xx_hal_pccard.h
│ │ │ ├── stm32f4xx_hal_pcd.h
│ │ │ ├── stm32f4xx_hal_pcd_ex.h
│ │ │ ├── stm32f4xx_hal_pwr.h
│ │ │ ├── stm32f4xx_hal_pwr_ex.h
│ │ │ ├── stm32f4xx_hal_qspi.h
│ │ │ ├── stm32f4xx_hal_rcc.h
│ │ │ ├── stm32f4xx_hal_rcc_ex.h
│ │ │ ├── stm32f4xx_hal_rng.h
│ │ │ ├── stm32f4xx_hal_rtc.h
│ │ │ ├── stm32f4xx_hal_rtc_ex.h
│ │ │ ├── stm32f4xx_hal_sai.h
│ │ │ ├── stm32f4xx_hal_sai_ex.h
│ │ │ ├── stm32f4xx_hal_sd.h
│ │ │ ├── stm32f4xx_hal_sdram.h
│ │ │ ├── stm32f4xx_hal_smartcard.h
│ │ │ ├── stm32f4xx_hal_spdifrx.h
│ │ │ ├── stm32f4xx_hal_spi.h
│ │ │ ├── stm32f4xx_hal_sram.h
│ │ │ ├── stm32f4xx_hal_tim.h
│ │ │ ├── stm32f4xx_hal_tim_ex.h
│ │ │ ├── stm32f4xx_hal_uart.h
│ │ │ ├── stm32f4xx_hal_usart.h
│ │ │ ├── stm32f4xx_hal_wwdg.h
│ │ │ ├── stm32f4xx_ll_fmc.h
│ │ │ ├── stm32f4xx_ll_fsmc.h
│ │ │ ├── stm32f4xx_ll_sdmmc.h
│ │ │ ├── stm32f4xx_ll_usb.h
│ │ │ └── system_stm32f4xx.h
│ │ ├── TARGET_NUCLEO_F411RE/
│ │ │ ├── TARGET_STM/
│ │ │ │ └── TARGET_STM32F4/
│ │ │ │ ├── PeripheralPins.h
│ │ │ │ ├── TARGET_NUCLEO_F411RE/
│ │ │ │ │ ├── PeripheralNames.h
│ │ │ │ │ ├── PinNames.h
│ │ │ │ │ ├── PortNames.h
│ │ │ │ │ ├── device.h
│ │ │ │ │ └── objects.h
│ │ │ │ └── gpio_object.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── STM32F411XE.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── hal_tick.o
│ │ │ │ ├── liblwipsysarch.a
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── libmbedeth.a
│ │ │ │ ├── mbed_overrides.o
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_stm32f411xe.o
│ │ │ │ ├── stm32f4xx_hal.o
│ │ │ │ ├── stm32f4xx_hal_adc.o
│ │ │ │ ├── stm32f4xx_hal_adc_ex.o
│ │ │ │ ├── stm32f4xx_hal_can.o
│ │ │ │ ├── stm32f4xx_hal_cec.o
│ │ │ │ ├── stm32f4xx_hal_cortex.o
│ │ │ │ ├── stm32f4xx_hal_crc.o
│ │ │ │ ├── stm32f4xx_hal_cryp.o
│ │ │ │ ├── stm32f4xx_hal_cryp_ex.o
│ │ │ │ ├── stm32f4xx_hal_dac.o
│ │ │ │ ├── stm32f4xx_hal_dac_ex.o
│ │ │ │ ├── stm32f4xx_hal_dcmi.o
│ │ │ │ ├── stm32f4xx_hal_dcmi_ex.o
│ │ │ │ ├── stm32f4xx_hal_dma.o
│ │ │ │ ├── stm32f4xx_hal_dma2d.o
│ │ │ │ ├── stm32f4xx_hal_dma_ex.o
│ │ │ │ ├── stm32f4xx_hal_dsi.o
│ │ │ │ ├── stm32f4xx_hal_eth.o
│ │ │ │ ├── stm32f4xx_hal_flash.o
│ │ │ │ ├── stm32f4xx_hal_flash_ex.o
│ │ │ │ ├── stm32f4xx_hal_flash_ramfunc.o
│ │ │ │ ├── stm32f4xx_hal_fmpi2c.o
│ │ │ │ ├── stm32f4xx_hal_fmpi2c_ex.o
│ │ │ │ ├── stm32f4xx_hal_gpio.o
│ │ │ │ ├── stm32f4xx_hal_hash.o
│ │ │ │ ├── stm32f4xx_hal_hash_ex.o
│ │ │ │ ├── stm32f4xx_hal_hcd.o
│ │ │ │ ├── stm32f4xx_hal_i2c.o
│ │ │ │ ├── stm32f4xx_hal_i2c_ex.o
│ │ │ │ ├── stm32f4xx_hal_i2s.o
│ │ │ │ ├── stm32f4xx_hal_i2s_ex.o
│ │ │ │ ├── stm32f4xx_hal_irda.o
│ │ │ │ ├── stm32f4xx_hal_iwdg.o
│ │ │ │ ├── stm32f4xx_hal_lptim.o
│ │ │ │ ├── stm32f4xx_hal_ltdc.o
│ │ │ │ ├── stm32f4xx_hal_ltdc_ex.o
│ │ │ │ ├── stm32f4xx_hal_msp_template.o
│ │ │ │ ├── stm32f4xx_hal_nand.o
│ │ │ │ ├── stm32f4xx_hal_nor.o
│ │ │ │ ├── stm32f4xx_hal_pccard.o
│ │ │ │ ├── stm32f4xx_hal_pcd.o
│ │ │ │ ├── stm32f4xx_hal_pcd_ex.o
│ │ │ │ ├── stm32f4xx_hal_pwr.o
│ │ │ │ ├── stm32f4xx_hal_pwr_ex.o
│ │ │ │ ├── stm32f4xx_hal_qspi.o
│ │ │ │ ├── stm32f4xx_hal_rcc.o
│ │ │ │ ├── stm32f4xx_hal_rcc_ex.o
│ │ │ │ ├── stm32f4xx_hal_rng.o
│ │ │ │ ├── stm32f4xx_hal_rtc.o
│ │ │ │ ├── stm32f4xx_hal_rtc_ex.o
│ │ │ │ ├── stm32f4xx_hal_sai.o
│ │ │ │ ├── stm32f4xx_hal_sai_ex.o
│ │ │ │ ├── stm32f4xx_hal_sd.o
│ │ │ │ ├── stm32f4xx_hal_sdram.o
│ │ │ │ ├── stm32f4xx_hal_smartcard.o
│ │ │ │ ├── stm32f4xx_hal_spdifrx.o
│ │ │ │ ├── stm32f4xx_hal_spi.o
│ │ │ │ ├── stm32f4xx_hal_sram.o
│ │ │ │ ├── stm32f4xx_hal_tim.o
│ │ │ │ ├── stm32f4xx_hal_tim_ex.o
│ │ │ │ ├── stm32f4xx_hal_uart.o
│ │ │ │ ├── stm32f4xx_hal_usart.o
│ │ │ │ ├── stm32f4xx_hal_wwdg.o
│ │ │ │ ├── stm32f4xx_ll_fmc.o
│ │ │ │ ├── stm32f4xx_ll_fsmc.o
│ │ │ │ ├── stm32f4xx_ll_sdmmc.o
│ │ │ │ ├── stm32f4xx_ll_usb.o
│ │ │ │ └── system_stm32f4xx.o
│ │ │ ├── arm_common_tables.h
│ │ │ ├── arm_const_structs.h
│ │ │ ├── arm_math.h
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── hal_tick.h
│ │ │ ├── stm32_hal_legacy.h
│ │ │ ├── stm32f411xe.h
│ │ │ ├── stm32f4xx.h
│ │ │ ├── stm32f4xx_hal.h
│ │ │ ├── stm32f4xx_hal_adc.h
│ │ │ ├── stm32f4xx_hal_adc_ex.h
│ │ │ ├── stm32f4xx_hal_can.h
│ │ │ ├── stm32f4xx_hal_cec.h
│ │ │ ├── stm32f4xx_hal_conf.h
│ │ │ ├── stm32f4xx_hal_conf_template.h
│ │ │ ├── stm32f4xx_hal_cortex.h
│ │ │ ├── stm32f4xx_hal_crc.h
│ │ │ ├── stm32f4xx_hal_cryp.h
│ │ │ ├── stm32f4xx_hal_cryp_ex.h
│ │ │ ├── stm32f4xx_hal_dac.h
│ │ │ ├── stm32f4xx_hal_dac_ex.h
│ │ │ ├── stm32f4xx_hal_dcmi.h
│ │ │ ├── stm32f4xx_hal_dcmi_ex.h
│ │ │ ├── stm32f4xx_hal_def.h
│ │ │ ├── stm32f4xx_hal_dma.h
│ │ │ ├── stm32f4xx_hal_dma2d.h
│ │ │ ├── stm32f4xx_hal_dma_ex.h
│ │ │ ├── stm32f4xx_hal_dsi.h
│ │ │ ├── stm32f4xx_hal_eth.h
│ │ │ ├── stm32f4xx_hal_flash.h
│ │ │ ├── stm32f4xx_hal_flash_ex.h
│ │ │ ├── stm32f4xx_hal_flash_ramfunc.h
│ │ │ ├── stm32f4xx_hal_fmpi2c.h
│ │ │ ├── stm32f4xx_hal_fmpi2c_ex.h
│ │ │ ├── stm32f4xx_hal_gpio.h
│ │ │ ├── stm32f4xx_hal_gpio_ex.h
│ │ │ ├── stm32f4xx_hal_hash.h
│ │ │ ├── stm32f4xx_hal_hash_ex.h
│ │ │ ├── stm32f4xx_hal_hcd.h
│ │ │ ├── stm32f4xx_hal_i2c.h
│ │ │ ├── stm32f4xx_hal_i2c_ex.h
│ │ │ ├── stm32f4xx_hal_i2s.h
│ │ │ ├── stm32f4xx_hal_i2s_ex.h
│ │ │ ├── stm32f4xx_hal_irda.h
│ │ │ ├── stm32f4xx_hal_iwdg.h
│ │ │ ├── stm32f4xx_hal_lptim.h
│ │ │ ├── stm32f4xx_hal_ltdc.h
│ │ │ ├── stm32f4xx_hal_ltdc_ex.h
│ │ │ ├── stm32f4xx_hal_nand.h
│ │ │ ├── stm32f4xx_hal_nor.h
│ │ │ ├── stm32f4xx_hal_pccard.h
│ │ │ ├── stm32f4xx_hal_pcd.h
│ │ │ ├── stm32f4xx_hal_pcd_ex.h
│ │ │ ├── stm32f4xx_hal_pwr.h
│ │ │ ├── stm32f4xx_hal_pwr_ex.h
│ │ │ ├── stm32f4xx_hal_qspi.h
│ │ │ ├── stm32f4xx_hal_rcc.h
│ │ │ ├── stm32f4xx_hal_rcc_ex.h
│ │ │ ├── stm32f4xx_hal_rng.h
│ │ │ ├── stm32f4xx_hal_rtc.h
│ │ │ ├── stm32f4xx_hal_rtc_ex.h
│ │ │ ├── stm32f4xx_hal_sai.h
│ │ │ ├── stm32f4xx_hal_sai_ex.h
│ │ │ ├── stm32f4xx_hal_sd.h
│ │ │ ├── stm32f4xx_hal_sdram.h
│ │ │ ├── stm32f4xx_hal_smartcard.h
│ │ │ ├── stm32f4xx_hal_spdifrx.h
│ │ │ ├── stm32f4xx_hal_spi.h
│ │ │ ├── stm32f4xx_hal_sram.h
│ │ │ ├── stm32f4xx_hal_tim.h
│ │ │ ├── stm32f4xx_hal_tim_ex.h
│ │ │ ├── stm32f4xx_hal_uart.h
│ │ │ ├── stm32f4xx_hal_usart.h
│ │ │ ├── stm32f4xx_hal_wwdg.h
│ │ │ ├── stm32f4xx_ll_fmc.h
│ │ │ ├── stm32f4xx_ll_fsmc.h
│ │ │ ├── stm32f4xx_ll_sdmmc.h
│ │ │ ├── stm32f4xx_ll_usb.h
│ │ │ └── system_stm32f4xx.h
│ │ ├── TARGET_NUCLEO_L152RE/
│ │ │ ├── TARGET_STM/
│ │ │ │ └── TARGET_STM32L1/
│ │ │ │ ├── PeripheralPins.h
│ │ │ │ ├── TARGET_NUCLEO_L152RE/
│ │ │ │ │ ├── PeripheralNames.h
│ │ │ │ │ ├── PinNames.h
│ │ │ │ │ ├── PortNames.h
│ │ │ │ │ ├── device.h
│ │ │ │ │ └── objects.h
│ │ │ │ └── gpio_object.h
│ │ │ ├── TOOLCHAIN_GCC_ARM/
│ │ │ │ ├── STM32L152XE.ld
│ │ │ │ ├── board.o
│ │ │ │ ├── cmsis_nvic.o
│ │ │ │ ├── hal_tick.o
│ │ │ │ ├── libmbed.a
│ │ │ │ ├── libmbedeth.a
│ │ │ │ ├── mbed_overrides.o
│ │ │ │ ├── retarget.o
│ │ │ │ ├── startup_stm32l152xe.o
│ │ │ │ ├── stm32l1xx_hal.o
│ │ │ │ ├── stm32l1xx_hal_adc.o
│ │ │ │ ├── stm32l1xx_hal_adc_ex.o
│ │ │ │ ├── stm32l1xx_hal_comp.o
│ │ │ │ ├── stm32l1xx_hal_cortex.o
│ │ │ │ ├── stm32l1xx_hal_crc.o
│ │ │ │ ├── stm32l1xx_hal_cryp.o
│ │ │ │ ├── stm32l1xx_hal_cryp_ex.o
│ │ │ │ ├── stm32l1xx_hal_dac.o
│ │ │ │ ├── stm32l1xx_hal_dac_ex.o
│ │ │ │ ├── stm32l1xx_hal_dma.o
│ │ │ │ ├── stm32l1xx_hal_flash.o
│ │ │ │ ├── stm32l1xx_hal_flash_ex.o
│ │ │ │ ├── stm32l1xx_hal_flash_ramfunc.o
│ │ │ │ ├── stm32l1xx_hal_gpio.o
│ │ │ │ ├── stm32l1xx_hal_i2c.o
│ │ │ │ ├── stm32l1xx_hal_i2s.o
│ │ │ │ ├── stm32l1xx_hal_irda.o
│ │ │ │ ├── stm32l1xx_hal_iwdg.o
│ │ │ │ ├── stm32l1xx_hal_lcd.o
│ │ │ │ ├── stm32l1xx_hal_nor.o
│ │ │ │ ├── stm32l1xx_hal_opamp.o
│ │ │ │ ├── stm32l1xx_hal_opamp_ex.o
│ │ │ │ ├── stm32l1xx_hal_pcd.o
│ │ │ │ ├── stm32l1xx_hal_pcd_ex.o
│ │ │ │ ├── stm32l1xx_hal_pwr.o
│ │ │ │ ├── stm32l1xx_hal_pwr_ex.o
│ │ │ │ ├── stm32l1xx_hal_rcc.o
│ │ │ │ ├── stm32l1xx_hal_rcc_ex.o
│ │ │ │ ├── stm32l1xx_hal_rtc.o
│ │ │ │ ├── stm32l1xx_hal_rtc_ex.o
│ │ │ │ ├── stm32l1xx_hal_sd.o
│ │ │ │ ├── stm32l1xx_hal_smartcard.o
│ │ │ │ ├── stm32l1xx_hal_spi.o
│ │ │ │ ├── stm32l1xx_hal_spi_ex.o
│ │ │ │ ├── stm32l1xx_hal_sram.o
│ │ │ │ ├── stm32l1xx_hal_tim.o
│ │ │ │ ├── stm32l1xx_hal_tim_ex.o
│ │ │ │ ├── stm32l1xx_hal_uart.o
│ │ │ │ ├── stm32l1xx_hal_usart.o
│ │ │ │ ├── stm32l1xx_hal_wwdg.o
│ │ │ │ ├── stm32l1xx_ll_fsmc.o
│ │ │ │ ├── stm32l1xx_ll_sdmmc.o
│ │ │ │ └── system_stm32l1xx.o
│ │ │ ├── cmsis.h
│ │ │ ├── cmsis_nvic.h
│ │ │ ├── core_ca9.h
│ │ │ ├── core_caFunc.h
│ │ │ ├── core_caInstr.h
│ │ │ ├── core_ca_mmu.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm4_simd.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_cmFunc.h
│ │ │ ├── core_cmInstr.h
│ │ │ ├── core_cmSimd.h
│ │ │ ├── hal_tick.h
│ │ │ ├── stm32l152xe.h
│ │ │ ├── stm32l1xx.h
│ │ │ ├── stm32l1xx_hal.h
│ │ │ ├── stm32l1xx_hal_adc.h
│ │ │ ├── stm32l1xx_hal_adc_ex.h
│ │ │ ├── stm32l1xx_hal_comp.h
│ │ │ ├── stm32l1xx_hal_comp_ex.h
│ │ │ ├── stm32l1xx_hal_conf.h
│ │ │ ├── stm32l1xx_hal_cortex.h
│ │ │ ├── stm32l1xx_hal_crc.h
│ │ │ ├── stm32l1xx_hal_cryp.h
│ │ │ ├── stm32l1xx_hal_cryp_ex.h
│ │ │ ├── stm32l1xx_hal_dac.h
│ │ │ ├── stm32l1xx_hal_dac_ex.h
│ │ │ ├── stm32l1xx_hal_def.h
│ │ │ ├── stm32l1xx_hal_dma.h
│ │ │ ├── stm32l1xx_hal_dma_ex.h
│ │ │ ├── stm32l1xx_hal_flash.h
│ │ │ ├── stm32l1xx_hal_flash_ex.h
│ │ │ ├── stm32l1xx_hal_flash_ramfunc.h
│ │ │ ├── stm32l1xx_hal_gpio.h
│ │ │ ├── stm32l1xx_hal_gpio_ex.h
│ │ │ ├── stm32l1xx_hal_i2c.h
│ │ │ ├── stm32l1xx_hal_i2s.h
│ │ │ ├── stm32l1xx_hal_irda.h
│ │ │ ├── stm32l1xx_hal_iwdg.h
│ │ │ ├── stm32l1xx_hal_lcd.h
│ │ │ ├── stm32l1xx_hal_nor.h
│ │ │ ├── stm32l1xx_hal_opamp.h
│ │ │ ├── stm32l1xx_hal_opamp_ex.h
│ │ │ ├── stm32l1xx_hal_pcd.h
│ │ │ ├── stm32l1xx_hal_pcd_ex.h
│ │ │ ├── stm32l1xx_hal_pwr.h
│ │ │ ├── stm32l1xx_hal_pwr_ex.h
│ │ │ ├── stm32l1xx_hal_rcc.h
│ │ │ ├── stm32l1xx_hal_rcc_ex.h
│ │ │ ├── stm32l1xx_hal_rtc.h
│ │ │ ├── stm32l1xx_hal_rtc_ex.h
│ │ │ ├── stm32l1xx_hal_sd.h
│ │ │ ├── stm32l1xx_hal_smartcard.h
│ │ │ ├── stm32l1xx_hal_spi.h
│ │ │ ├── stm32l1xx_hal_spi_ex.h
│ │ │ ├── stm32l1xx_hal_sram.h
│ │ │ ├── stm32l1xx_hal_tim.h
│ │ │ ├── stm32l1xx_hal_tim_ex.h
│ │ │ ├── stm32l1xx_hal_uart.h
│ │ │ ├── stm32l1xx_hal_usart.h
│ │ │ ├── stm32l1xx_hal_wwdg.h
│ │ │ ├── stm32l1xx_ll_fsmc.h
│ │ │ ├── stm32l1xx_ll_sdmmc.h
│ │ │ └── system_stm32l1xx.h
│ │ ├── Ticker.h
│ │ ├── Timeout.h
│ │ ├── Timer.h
│ │ ├── TimerEvent.h
│ │ ├── Transaction.h
│ │ ├── analogin_api.h
│ │ ├── analogout_api.h
│ │ ├── buffer.h
│ │ ├── can_api.h
│ │ ├── can_helper.h
│ │ ├── dma_api.h
│ │ ├── ethernet_api.h
│ │ ├── gpio_api.h
│ │ ├── gpio_irq_api.h
│ │ ├── i2c_api.h
│ │ ├── lp_ticker_api.h
│ │ ├── mbed.h
│ │ ├── mbed_assert.h
│ │ ├── mbed_debug.h
│ │ ├── mbed_error.h
│ │ ├── mbed_interface.h
│ │ ├── pinmap.h
│ │ ├── platform.h
│ │ ├── port_api.h
│ │ ├── pwmout_api.h
│ │ ├── rtc_api.h
│ │ ├── rtc_time.h
│ │ ├── semihost_api.h
│ │ ├── serial_api.h
│ │ ├── sleep_api.h
│ │ ├── spi_api.h
│ │ ├── ticker_api.h
│ │ ├── toolchain.h
│ │ ├── us_ticker_api.h
│ │ └── wait_api.h
│ ├── os_layer/
│ │ ├── ARMv7M/
│ │ │ └── Vectors/
│ │ │ ├── startup_LPC17xx.S
│ │ │ ├── startup_MK64F12.S
│ │ │ ├── startup_stm32f091xc.S
│ │ │ ├── startup_stm32f401xe.S
│ │ │ ├── startup_stm32f411xe.S
│ │ │ └── startup_stm32l152xe.S
│ │ ├── inc/
│ │ │ ├── api/
│ │ │ │ ├── io/
│ │ │ │ │ ├── llos_analog.h
│ │ │ │ │ ├── llos_gpio.h
│ │ │ │ │ ├── llos_i2c.h
│ │ │ │ │ ├── llos_pwm.h
│ │ │ │ │ ├── llos_serial.h
│ │ │ │ │ └── llos_spi.h
│ │ │ │ └── llos_memory.h
│ │ │ ├── hal/
│ │ │ │ ├── llos_clock.h
│ │ │ │ ├── llos_mutex.h
│ │ │ │ ├── llos_system_timer.h
│ │ │ │ └── llos_thread.h
│ │ │ ├── llos_error.h
│ │ │ ├── llos_platform.h
│ │ │ ├── llos_types.h
│ │ │ └── llos_unwind.h
│ │ └── ports/
│ │ ├── mbed/
│ │ │ ├── MbedOSAbstraction.vcxproj
│ │ │ ├── mbed_adc.cpp
│ │ │ ├── mbed_asm.S
│ │ │ ├── mbed_clock.cpp
│ │ │ ├── mbed_core.cpp
│ │ │ ├── mbed_debug.cpp
│ │ │ ├── mbed_ethernet.cpp
│ │ │ ├── mbed_gpio.cpp
│ │ │ ├── mbed_helpers.h
│ │ │ ├── mbed_i2c.cpp
│ │ │ ├── mbed_mem.cpp
│ │ │ ├── mbed_memory.cpp
│ │ │ ├── mbed_nvic.cpp
│ │ │ ├── mbed_overrides.cpp
│ │ │ ├── mbed_pwm.cpp
│ │ │ ├── mbed_serial.cpp
│ │ │ ├── mbed_socket.cpp
│ │ │ ├── mbed_spi.cpp
│ │ │ ├── mbed_system_timer.cpp
│ │ │ ├── mbed_systick.cpp
│ │ │ ├── mbed_threading.cpp
│ │ │ └── mbed_unwind.cpp
│ │ └── win32/
│ │ └── Win32Abstraction/
│ │ ├── LlosClock.cpp
│ │ ├── LlosDebug.cpp
│ │ ├── LlosEntry.cpp
│ │ ├── LlosGarbageCollection.cpp
│ │ ├── LlosMemory.cpp
│ │ ├── LlosMutex.cpp
│ │ ├── LlosStubs.cpp
│ │ ├── LlosThread.cpp
│ │ ├── LlosTimer.cpp
│ │ ├── LlosUnwind.cpp
│ │ ├── LlosWin32.h
│ │ ├── Win32Abstraction.vcxproj
│ │ └── Win32Abstraction.vcxproj.filters
│ ├── startVS.cmd
│ └── tools/
│ └── readme.txt
├── docs/
│ └── CoAP/
│ └── readme.txt
├── llilum.vssettings
├── setenv.cmd
└── setenv32.cmd
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=binary
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
================================================
FILE: .gitignore
================================================
## LLVM and Zelig
external/LLVM/
external/gcc4mbed/
zelig/LLVM2IR_results/mbed/simple/LPC1768/
zelig/LLVM2IR_results/mbed/simple/K64F/
zelig/LLVM2IR_results/mbed/simple/STM32L152/
zelig/LLVM2IR_results/mbed/simple/STM32F411/
zelig/LLVM2IR_results/mbed/simple/STM32F401/
zelig/LLVM2IR_results/mbed/simple/STM32F091/
zelig/LLVM2IR_results/mbed/simple/*.xml
Zelig/LLVM2IR_results/mbed/test/LPC1768/
Zelig/LLVM2IR_results/mbed/test/K64F/
Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/LPC1768/
Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/K64F/
Zelig/mbed-rtos/
Zelig/mbed-rtos.lib
*.IrTxtpost
*.ZeligIR
*.ZeligIR.xml
*.ZeligIR_Post
*.ZeligImage
*.ElfDump
*.ZeligCallsFromGraph
*.ZeligCallsToGraph
*.bc
*.ll
*.bc
*_opt.o
*.opendb
## OpenOCD
Zelig/tools/openocd/*
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Zelig/zelig-pr.wiki/
# User-specific files
*.cache
*.FileListAbsolute.txt
*.suo
*.user
*.userosscache
*.sln.docstates
*tmp_debug.bat
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
*.bc
*.ll
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*.log
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
*.[Cc]ache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
*.tlog
#Default build output location for CreateSDKDrop.bat
/Scripts/SDKDrop
Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/Win32/RelWithDebInfo/LibLLVM.3.6.1.dll
Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/Win32/RelWithDebInfo/LibLLVM.3.6.1.exp
Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/Win32/RelWithDebInfo/LibLLVM.3.6.1.iobj
Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/Win32/RelWithDebInfo/LibLLVM.3.6.1.ipdb
Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/Win32/RelWithDebInfo/LibLLVM.3.6.1.lib
Zelig/Zelig/CompileTime/Llvm.NET/Win32/RelWithDebInfo/Llvm.NET.dll
*.opendb
/Zelig/Zelig/CompileTime/Llvm.NET/LibLLVM/generatedversioninfo.h
/LlilumSDK/LlilumSDK/FrameworkList.xml
Zelig/Zelig/Zelig.VC.db
================================================
FILE: BuildEnv.props
================================================
$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))
$(LLILUM_ROOT)Zelig\
3.8.1
$([MSBuild]::GetRegistryValue(`HKEY_CURRENT_USER\Software\LLVM\$(LLVM_VERSION)\`, `SrcRoot`))
$([MSBuild]::GetRegistryValueFromView(`HKEY_LOCAL_MACHINE\Software\LLVM\$(LLVM_VERSION)\`, `SrcRoot`, null, RegistryView.Registry64, RegistryView.Registry32))
$(LLVM_SRCROOT_DIR)\
$(LLVM_SRCROOT_DIR)
$(MSBuildThisFileDirectory)Zelig\ZeligBuild
$(MSBuildThisFileDirectory)Zelig\Zelig
$([MSBuild]::GetRegistryValueFromView(`HKEY_LOCAL_MACHINE\Software\GnuWin32\`, `InstallPath`, null, RegistryView.Registry32))
$(GnuWin32MakeInstallPath)\
================================================
FILE: LICENSE
================================================
LLILUM
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ""Software""), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: LlilumSDK/GenerateFrameworkList/App.config
================================================
================================================
FILE: LlilumSDK/GenerateFrameworkList/GenerateFrameworkList.csproj
================================================
Debug
AnyCPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}
Exe
Properties
GenerateFrameworkList
GenerateFrameworkList
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
v4.5.2
512
true
AnyCPU
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
AnyCPU
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
================================================
FILE: LlilumSDK/GenerateFrameworkList/Program.cs
================================================
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Xml.Linq;
using System.Reflection;
namespace GenerateFrameworkList
{
/// Build utility to generate the .NET Multitargeting Frameworklist.xml file from the WIX source
///
/// The FrameworkList.xml file contains information about a framework and it's assemblies for the
/// multi-targeting support in Visuals Studio and MSBuild. In particular it contains details of the
/// assemblies as 'File' elements. Given that the WIX source already lists all the files to go into
/// the MSI this tool saves on duplication of data (and the potential for errors) by generating the
/// FrameworkList.xml from the wix source itself, thus acurately reflecting what is actually installed.
/// This is not doen as an MSBuild task due to the fact that it needs to load the assemblies via
/// reflection to determine the values of various attributes for the 'generated 'File' elements. Assemblies
/// loaded via reflection are never unloaded unless the AppDomain they are loaded into is unloaded. Also,
/// MSBuild uses an optimization that leaves an instance of istelf running under the expectation that,
/// during a build, it will be needed again, thus eliminating the need to reload and re-jit everything.
/// This means that the MSBuild task would load the assemblies and then linger around after the build is
/// finished holding on to an open file for the loaded assemblies, causing weird issues with "File in use"
/// types of errors. While it is plausible to write an MSBuild task to run it's core functionality in an
/// isolated AppDomain, doing this as a seperate exe is simpler and more obvious.
///
///
class Program
{
const string LlilumFrameworkDisplayName = "Llilum 1.0";
const string LlilumRedistComponentId = "Microsoft-Llilum-CLRCoreComp-1.0";
const string WixNamespace = "http://schemas.microsoft.com/wix/2006/wi";
private readonly static XName WixComponentGroupElementName = XName.Get("ComponentGroup", WixNamespace);
private readonly static XName WixFileElementName = XName.Get("File", WixNamespace);
/// Entry point for the application
/// Input command line args
/// 0 on success non zero on error
///
/// Commandline args:
///
/// - Wix SourceWix fragment source file describing the framework assemblies component
/// - InputPathPath to use when finding the assemblies referenced in the Wix Source
/// - OutputPathPath write the generated FrameworkList.xml file into
///
///
static int Main(string[] args)
{
string inputXml;
string outputPath;
string inputPath;
if (!ValidateArgs( args, out inputXml, out inputPath, out outputPath ))
{
return -1;
}
using (var strm = File.OpenText(inputXml))
{
var fileListElement = new XElement("FileList"
, new XAttribute("Name", LlilumFrameworkDisplayName)
, new XAttribute("Redist", LlilumRedistComponentId)
, new XAttribute("ToolsVersion", "4.0")
);
var outputDoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), fileListElement);
var inputDoc = XDocument.Load(strm);
// find the files elements in the component group containing all the reference assemblies
// only use files with the KeyPath == 'yes" as the others are the PDBs.
var assemblyFiles = from componentGroup in inputDoc.Descendants(WixComponentGroupElementName)
where componentGroup.Attribute("Id")?.Value == "ReferenceAssembliesComponentGroup"
from file in componentGroup.Descendants(WixFileElementName)
where file.Attribute("KeyPath")?.Value == "yes"
select Path.Combine(inputPath, file.Attribute("Name").Value);
foreach (var assemblyFile in assemblyFiles)
{
try
{
var assembly = Assembly.ReflectionOnlyLoadFrom(assemblyFile);
AssemblyName name = assembly.GetName();
fileListElement.Add(new XElement("File"
, new XAttribute("AssemblyName", name.Name)
, new XAttribute("Version", name.Version.ToString())
, new XAttribute("PublicKeyToken", FormatPublicKeyToken(name))
, new XAttribute("Culture", name.CultureName)
, new XAttribute("ProcessorArchitecture", name.ProcessorArchitecture.ToString())
, new XAttribute("InGac", "false")
)
);
}
catch( BadImageFormatException )
{ /*ignore unmanaged binaries */ }
catch( FileLoadException )
{ /*ignore unloadeable binaries */ }
}
outputDoc.Save(Path.Combine(outputPath, "FrameworkList.xml"));
}
return 0;
}
private static string FormatPublicKeyToken(AssemblyName name)
{
var token = name.GetPublicKeyToken();
if (token == null || token.Length == 0)
return string.Empty;
var bldr = new StringBuilder(token.Length * 2);
for (int i = 0; i < token.Length; i++)
bldr.AppendFormat("{0:x2}", token[i]);
return bldr.ToString();
}
private static bool ValidateArgs(string[] args, out string inputWixFragment, out string inputPath, out string outputPath )
{
if ( args.Length != 3)
{
Console.WriteLine("Incorrect number of arguments provided");
inputWixFragment = null;
inputPath = null;
outputPath = null;
return false;
}
inputWixFragment = FixQuotedArg(args[0]);
inputPath = FixQuotedArg(args[1]);
outputPath = FixQuotedArg(args[2]);
if (string.IsNullOrWhiteSpace(inputWixFragment))
{
Console.Error.WriteLine("Empty strings for InputWixFragment are not allowed");
return false;
}
if (!File.Exists(inputWixFragment))
{
Console.Error.WriteLine("File '{0}' specified in InputWixFragment does not exist", inputWixFragment);
return false;
}
if (string.IsNullOrWhiteSpace(inputPath))
{
Console.Error.WriteLine("Empty strings for InputPath are not allowed");
return false;
}
if (!Directory.Exists(inputPath))
{
Console.Error.WriteLine("Directory '{0}' specified for InputPath does not exist", inputPath);
return false;
}
if (string.IsNullOrWhiteSpace(outputPath))
{
Console.Error.WriteLine("Empty strings for OutputPath are not allowed");
return false;
}
if (!Directory.Exists(args[1]))
{
Console.Error.WriteLine("Directory '{0}' specified for OutputPath does not exist", outputPath);
return false;
}
return true;
}
private static string FixQuotedArg(string arg)
{
// .NET arg parsing has an unfortunate side effect for paths containing a trailing seperator.
// On Windows when the arg is quoted (e.g. "c:\path\sub path\" ) the trailing \" is treated
// as an escaped " character and the \ is lost. This fixes that case
if (arg[arg.Length - 1] == '"')
return arg.Substring(0, arg.Length - 1);
else
return arg;
}
}
}
================================================
FILE: LlilumSDK/GenerateFrameworkList/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GenerateFrameworkList")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GenerateFrameworkList")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2c5bd91f-c52c-4e90-a290-cb7f0b55fb27")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: LlilumSDK/LlilumSDK/BoardConfigurations.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK/Directories.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK/HarvestDirectories.targets
================================================
true
true
NativeOsLayerComponentGroup
wix.LlilumZeligOsLayerDir
INSTALLDIR
NativeMbedLibComponentGroup
wix.LlilumZeligMbedDir
INSTALLDIR
NativeMbedRtosComponentGroup
wix.LlilumZeligMbedRtosDir
INSTALLDIR
NativelWipComponentGroup
wix.LlilumZeligLwipDir
INSTALLDIR
ThirdPartyToolsComponentGroup
wix.LlilumZeligToolsDir
INSTALLDIR
ZeligTestComponentGroup
wix.LlilumZeligZeligTestDir
INSTALLDIR
CpsProjectSystemComponentGroup
wix.LlilumApplicationTypeDir
CpsApplicationTypeFolder
MarkComponentsWin32.xslt
true
================================================
FILE: LlilumSDK/LlilumSDK/LlilumSDK.wixproj
================================================
Debug
x64
3.10
3aeaaaeb-954f-43c1-9b4b-9d2e29dcd0d7
2.0
LlilumSDK
Package
$(LLILUM_ROOT)
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets
$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets
LlilumRoot=$(LlilumRoot)
$(WixVariables);CpsBuildSourceDir=$(LlilumRoot)\VisualStudio\LlilumApplicationType
$(WixVariables);LlilumTargetBuildOutput=$(LlilumRoot)\Zelig\ZeligBuild\Target\bin\$(Configuration)
$(WixVariables);LlilumHostBuildOutput=$(LlilumRoot)\Zelig\ZeligBuild\Host\bin\$(Configuration)
$(WixVariables);LlilumLlvmBin=$(LLILUM_LLVM)\build\x64\Release\bin
true
true
$(LlilumRoot)\Zelig\os_layer
$(WixVariables);LlilumZeligOsLayerDir=$(LlilumZeligOsLayerDir)
$(LlilumRoot)\Zelig\mbed
$(WixVariables);LlilumZeligMbedDir=$(LlilumZeligMbedDir)
$(LlilumRoot)\Zelig\mbed-rtos
$(WixVariables);LlilumZeligMbedRtosDir=$(LlilumZeligMbedRtosDir)
$(LlilumRoot)\Zelig\lwip
$(WixVariables);LlilumZeligLwipDir=$(LlilumZeligLwipDir)
$(LlilumRoot)\Zelig\tools
$(WixVariables);LlilumZeligToolsDir=$(LlilumZeligToolsDir)
$(LlilumRoot)\Zelig\Zelig\test
$(WixVariables);LlilumZeligZeligTestDir=$(LlilumZeligZeligTestDir)
$(LlilumRoot)\VisualStudio\LlilumApplicationType
$(WixVariables);LlilumApplicationTypeDir=$(LlilumApplicationTypeDir)
LlilumSDK
Debug;RegAndFolderShortVersionString=v1.0
$(WixVariables);WixUILicenseRtf=$(MSBuildThisFileDirectory)\LlilumSDKLic.rtf
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
RegAndFolderShortVersionString=v1.0
$(WixVariables);WixUILicenseRtf=$(MSBuildThisFileDirectory)\LlilumSDKLic.rtf
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
GenerateFrameworkList
{2c5bd91f-c52c-4e90-a290-cb7f0b55fb27}
True
True
Binaries;Content;Satellites
INSTALLFOLDER
$(WixExtDir)\WixVSExtension.dll
WixVSExtension
$(WixExtDir)\WixUIExtension.dll
WixUIExtension
Always
"$(LlilumBuildRoot)\Host\bin\$(Configuration)\GenerateFrameworkList" "$(ProjectDir)\ReferenceAssemblies.wxs" "$(LlilumRoot)\Zelig\ZeligBuild\Target\bin\$(Configuration)" "$(ProjectDir)"
================================================
FILE: LlilumSDK/LlilumSDK/LlilumSDKLic.rtf
================================================
{\rtf1\ansi\ansicpg1252\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset0 Consolas;}{\f2\fnil Consolas;}{\f3\fnil\fcharset2 Symbol;}}
{\colortbl ;\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}
{\*\generator Riched20 10.0.10587}\viewkind4\uc1
\pard\sa200\sl240\slmult1\b\f0\fs44\lang9 Welcome to Llilum 1.0\par
\b0\fs22 Llilum is goverend by the MIT License\par
(see full text below)\par
\b\fs28 Additional components:\b0\fs22\par
Llilum incorporates the following additional\par
components goverend by their own terms:\par
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-360\li360\sa200\sl240\slmult1 LLVM libraries and tools\par
\pard\sa200\sl240\slmult1 University of Illinois Open Source License (See full text below)\par
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-360\li360\sa200\sl240\slmult1 ARM mBed Headers and libraries\par
\pard\sa200\sl240\slmult1 Apache 2.0 (See reference below)\par
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-360\li360\sa200\sl240\slmult1 LWIP netowrking stack\par
\pard\sa200\sl240\slmult1 Swedish Institute of Computer Science Lic. (See full bext below)\par
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-360\li360\sa200\sl240\slmult1 pyOCD mbed CMSIS-DAP Debugger\par
\pard\sa200\sl240\slmult1 Apache 2.0 (See reference Below)\par
\pard\sa200\sl240\slmult1\cf1\highlight2\f1\fs19\lang1033 ---------------------------------------\f2\lang9\par
\b\fs32 The MIT License (MIT)\par
\b0\fs19 Copyright (c) 2015 Microsoft\par
\par
Permission is hereby granted, free of charge, to any person obtaining a copy\f1\lang1033 \f2\lang9 of this software and associated documentation files (the "Software"), to\f1\lang1033 \f2\lang9 deal\f1\lang1033 \f2\lang9 in the Software without restriction, including without limitation the rights\f1\lang1033 \f2\lang9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\f1\lang1033 \f2\lang9 copies of the Software, and to permit persons to whom the Software is\f1\lang1033 \f2\lang9 furnished to do so, subject to the following \f1\lang1033 c\f2\lang9 onditions:\par
The above copyright notice and this permission notice shall be included in\f1\lang1033 \f2\lang9 all copies or substantial portions of the\f1\lang1033 \f2\lang9 Software.\par
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\f1\lang1033 \f2\lang9 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\f1\lang1033 \f2\lang9 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\f1\lang1033 \f2\lang9 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\f1\lang1033 \f2\lang9 LIABILITY, WHETHER IN AN ACTION OF\f1\lang1033 \f2\lang9 CONTRACT, TORT OR OTHERWISE, ARISING\f1\lang1033 \f2\lang9 FROM,\f1\lang1033 \f2\lang9 OUT OF OR IN CONNECTION WITH THE\f1\lang1033 \f2\lang9 SOFTWARE OR THE USE OR OTHER DEALINGS IN\f1\lang1033 \f2\lang9 THE SOFTWARE.\par
\f1\lang1033 ---------------------------------------\cf0\highlight0\f0\fs22\lang9\par
==============================================================\par
LLVM Release License\par
==============================================================\par
University of Illinois/NCSA\par
Open Source License\par
Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.\par
All rights reserved.\par
\par
Developed by:\par
LLVM Team\par
University of Illinois at Urbana-Champaign\par
{{\field{\*\fldinst{HYPERLINK http://llvm.org }}{\fldrslt{http://llvm.org\ul0\cf0}}}}\f0\fs22\par
\par
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par
\pard{\pntext\f3\'B7\tab}{\*\pn\pnlvlblt\pnf3\pnindent0{\pntxtb\'B7}}\fi-360\li720\sa200\sl240\slmult1 Redistributions of source code must retain the above copyright notice,this list of conditions and the following disclaimers.\par
{\pntext\f3\'B7\tab}Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.\par
{\pntext\f3\'B7\tab}Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.\par
\pard\sa200\sl240\slmult1 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.\par
==============================================================\par
Copyrights and Licenses for Third Party Software Distributed with LLVM:\par
==============================================================\par
The LLVM software contains code written by third parties. Such software will have its own individual LICENSE.TXT file in the directory in which it appears. This file will describe the copyrights, license, and restrictions which apply to that code.\par
The disclaimer of warranty in the University of Illinois Open Source License applies to all code in the LLVM Distribution, and nothing in any of the other licenses gives permission to use the names of the LLVM Team or the University of Illinois to endorse or promote products derived from this Software.\par
The following pieces of software have additional or alternate copyrights, licenses, and/or restrictions:\par
\ul Program Directory\par
\ulnone Autoconf llvm/autoconf\par
llvm/projects/ModuleMaker/autoconf\par
Google Test llvm/utils/unittest/googletest\par
OpenBSD regex llvm/lib/Support/\{reg*, COPYRIGHT.regex\}\par
pyyaml tests llvm/test/YAMLParser/\{*.data, LICENSE.TXT\}\par
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT\par
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h\par
\cf1\highlight2\f1\fs19\lang1033 ---------------------------------------\cf0\highlight0\f0\fs22\lang9\par
LwIP License\par
Copyright (c) 2001, 2002 Swedish Institute of Computer Science.\par
All rights reserved. \par
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\par
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. \par
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\par
3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. \par
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\par
\cf1\highlight2\f1\fs19\lang1033 ---------------------------------------\par
mbed Microcontroller Library\par
Copyright (c) 2006-2013 ARM Limited\par
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\par
{\cf0{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f1\fs19\par
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \par
---------------------------------------\par
mbed CMSIS-DAP debugger\par
Copyright (c) 2015 ARM Limited\par
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\par
{{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f1\fs19\par
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\cf0\highlight0\f0\fs22\lang9\par
\cf1\highlight2\f1\fs19\lang1033 ---------------------------------------\par
\cf0\highlight0\f0\fs22\lang9\par
\par
\par
\par
}
================================================
FILE: LlilumSDK/LlilumSDK/LlvmTools.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK/MarkComponentsWin32.xslt
================================================
no
================================================
FILE: LlilumSDK/LlilumSDK/PreConditions.wxi
================================================
Installed OR VS2015_COMMUNITY_EDITION_INSTALLED OR VS2015_PROFESSIONAL_EDITION_INSTALLED OR VS2015_PREMIUM_EDITION_INSTALLED OR VS2015_ENTERPRISE_EDITION_INSTALLED
Installed OR VS2015_IDE_VCSHARP_PROJECTSYSTEM_INSTALLED
Installed OR VS2015_IDE_VC_PROJECTSYSTEM_INSTALLED
Installed OR VS2015_VC_CROSS_PLATFORM_MOBILE_TOOLS_INSTALLED
Installed OR EMBEDDED_GCC_INSTALLED
================================================
FILE: LlilumSDK/LlilumSDK/Product.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK/ReferenceAssemblies.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK/ToolsBin.wxs
================================================
================================================
FILE: LlilumSDK/LlilumSDK.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateFrameworkList", "GenerateFrameworkList\GenerateFrameworkList.csproj", "{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "LlilumSDK", "LlilumSDK\LlilumSDK.wixproj", "{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{88A50C99-9B62-4F44-B515-B0E15F80E9A7}"
ProjectSection(SolutionItems) = preProject
readme.md = readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Debug|x64.ActiveCfg = Debug|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Debug|x64.Build.0 = Debug|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Release|Any CPU.Build.0 = Release|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Release|x64.ActiveCfg = Release|Any CPU
{2C5BD91F-C52C-4E90-A290-CB7F0B55FB27}.Release|x64.Build.0 = Release|Any CPU
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Debug|Any CPU.ActiveCfg = Debug|x64
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Debug|x64.ActiveCfg = Debug|x64
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Debug|x64.Build.0 = Debug|x64
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Release|Any CPU.ActiveCfg = Release|x64
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Release|x64.ActiveCfg = Release|x64
{3AEAAAEB-954F-43C1-9B4B-9D2E29DCD0D7}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: LlilumSDK/readme.md
================================================
### Llilum SDK Installer
This folder contains the Solution for building the Llilum SDK MSI installer.
##### Prerequisites
The installer is built using the [Windows Installer XML (Wix) v3.10.2](https://wix.codeplex.com/downloads/get/1540240)
#### Building the Binaries that go into the SDK
The SDK will incorporate the binareis built by other projects in the build. While it might make sense to define
dependencies in the solution on those projects so that a single project builds everything - that doesn't really work
for automated builds with digital signatures for a final production release. The binaries in the MSI must all get a
proper digital signature and or strong name signed before they are bound into the MSI. After that the MSI is generated
a signature is generated for the MSI itself. Thus keeping the MSI build isolated helps in managing the multi-stage
process of creating a fully signed release build.
The Following solutions and projects must be built to provide the input binaries for the SDK MSI:
1. Zelig.sln solution
2. BoardConfigurations.sln solution
###### Note:
In the future the output of the board configurations solution will not go into the SDK itself, rather it will convert to a sample project
that **uses** the SDK to create Board Support packages. This would include bundling the output of the build to a NUGET package to make
adding a BSP to a project a simple act of adding a NUGET pacakge. This requires re-working the native project system to move the board
selection and related properties out of the built in build infrastructure. We haven't quite made it that far so, for the short term the
SDK includes the board configurations built in the Llilum core team.
#### Building the MSI
You need to install the Wix Toolset before you can build this solution. Once you have installed the Wix Toolset follow these simple steps:
1. Open the LlilumSDK.sln solution file
2. Select **Build | Build Solution**
3. The MSI will be gnerated into the ZeligBuild\Host\bin\$(Configuration) folder
#### Using the SDK
In order to use the SDK you must install the following:
1. The MSI
2. The VSIX package for the Llilum project system.
3. The ARM GCC compiler (Assuming you are targeting Cortex-M class devices)
4. Appropriate Debugger components (pyOCD, OpenOCD, mBed Serial Drivers, etc...)
Once you have installed these you can open Visual Studio and create a new LlilumApplication and code away...
###### NOTE:
The SDK and VSIX package are not bundled together to allow for faster and simpler updates as well as to keep the SDK from becoming
bound to a specific version of Visual Studio. The release cadence of VS has increased dramatically and maintaining multiple variants
of the SDK for each VS version is logistically challenging and distracting.
At best we could add a bootstrapper executable that installed the MSI, then detected VS installations and downloaded the appropriate
VSIX pacakges. That is a significant amount of work as the bootstrapper would require a fairly high degree of future proofing to ensure
it could detect future Visual Studio installations, AND find an appropriate VSIX package to go with it. Ideally that would *not* require
creating a new web service to provide information to the bootstrapper. (Although leveraging the public readable nature of Github over
HTTPS, it could use a data file pushed on GitHub to pull down and use to extract information) None of that is particularly deeply thought
out or considered for active development yet.
================================================
FILE: LlvmApplication.props
================================================
3.8.1
$([MSBuild]::GetRegistryValue(`HKEY_CURRENT_USER\Software\LLVM\$(LLVM_VERSION)\`, `SrcRoot`))
$(LLVM_SRCROOT_DIR)\
$(LLVM_SRCROOT_DIR)Build\
$(LLVM_BUILD_DIR)\
$(LLVM_SRCROOT_DIR)Include
$(LLVM_BUILD_DIR)$(Platform)\
$(LLVM_PLATFORM_DIR)$(Configuration)\
$(LLVM_PLATFORM_DIR)Include\
$(LLVM_CONFIG_DIR)bin\
$(LLVM_CONFIG_DIR)lib\
@(AllLlvmLibs)
$(LLVM_CONFIG_INCLUDE);$(LLVM_INCLUDE);%(AdditionalIncludeDirectories)
4267;4244;4800;4291;4996
$(AllLlvmStaticLibs);$(AdditionalDependencies)
================================================
FILE: README.md
================================================
Welcome to LLILUM!
==================
A development platform for IL based languages and UWP applications targeting Cortex-M processors.
## Why LLILUM
Cortex-M processors are heavily resource constrained, and yet, because of their low power consumption and optimized interrupt dispatching, are arguably the most suitable solution for IoT applications.
Existing development platfoms and tool chains that target this space are based on C/C++, and no native support for higher level languages and RAD environment exist that can take advantage of what a Cortex-M HW can offer.
Previous efforts in this space include [.NET Micro Framework](https://github.com/NETMF/netmf-interpreter) and other Java solutions, which are sometimes too large in code size, too slow or too difficult to extend for mainstream adoption.
LLILUM implements a scalable alternative to C/C++ that features comparable code size and speed, as well as easy extensibility from within the Visual Studio development tool chain.
## What is LLILUM
LLILUM is an optimizing compiler tool chain based on the latest [CLI](http://www.ecma-international.org/publications/standards/Ecma-335.htm) standard and [LLVM](http://llvm.org/) version [3.8.1](http://llvm.org/releases/download.html#3.8.1).
LLILUM relies on the compelling development experience of Visual Studio to transform source code into MSIL, and then into an intermediate represenation (IR) that is optmized for size and speed, taking into account the target platform constraints, such as memory layout, native ISA, calling convention, and, first and foremost, the application requirements. The method and type closure is optimized based on application usage of system facilities, and the type system is morphed to shrink into the smallest possible footprint. Debugging is carried out through Visual Studio and GDB.
Standard features of CLI environments, e.g. type system (TS) introspection, garbage collection (GC) and a full featured multi-threaded execution engine (MTEE) are provided.
# State of the Art
LLILUM can generate runnable images for ARMv4 and ARMv5 ISA, with partial FP support. We could have extended the code generator to support ARMv7-M but we decided to leverage LLVM instead, hoping we can get a wider set of targets over time.
The current incarnation of the system successfully uses LLVM to target:
* Cortex-M0/3/4 ISA with
* A fully functional Managed Type System and FP support
* A reference counting collector
* A conservative tracing collector (Bohem GC)
* A fully multi-threaded execution environment compatible with Cortex-M architecture for `NVIC` and `SysTick` standard controllers
* [lwIP](http://savannah.nongnu.org/projects/lwip/) TCP/IP stack
* [CMSIS-RTOS](http://www.keil.com/pack/doc/cmsis/RTOS/html/index.html) porting layer for easy network stack porting
* Visual Studio SDK with GDB debugging
# Supported Hardware
LLILUM supports a significant number of development boards from the [mBed](https://www.mbed.com/en/) ecosystem, and specifically:
* [Freescale K64F-FRDM](https://developer.mbed.org/platforms/FRDM-K64F/) Cortex-M4 development board
* [NXP LPC1768](https://developer.mbed.org/platforms/mbed-LPC1768/) Cortex-M3 development board
* [STMicroelectronics STM32F091RC](https://developer.mbed.org/platforms/ST-Nucleo-F091RC/) Cortex-M0 development board
* [STMicroelectronics STM32F401RE](https://developer.mbed.org/platforms/ST-Nucleo-F401RE/) Cortex-M3 development board
* [STMicroelectronics STM32F411RE](https://developer.mbed.org/platforms/ST-Nucleo-F411RE/) Cortex-M4 development board
* [STMicroelectronics STM32L152RE](https://developer.mbed.org/platforms/ST-Nucleo-L152RE/) Cortex-M3 development board
# Supported Languages
Currrent target language is C#; extensions to Python and possibly TypeScript are in the works. We are also targeting [UWP](https://msdn.microsoft.com/en-us/library/dn894631.aspx) app development, so that it will be possible to share code between a Windows 10 device app and a Cortex-M micro processor. Welcome to OneCore!
# Further reading
Please see the following documents in our wiki:
Welcome to the _llilum_ wiki!
1. [Detailed system description](https://github.com/NETMF/llilum-pr/wiki/System)
1. [Build System](https://github.com/NETMF/llilum-pr/wiki/Building)
2. [Front End Configuration](https://github.com/NETMF/llilum-pr/wiki/LLILUM-Compiler-Frontend)
2. [Setup and build instruction](https://github.com/NETMF/llilum-pr/wiki/Setup)
3. [Build and run test demo](https://github.com/NETMF/llilum-pr/wiki/Demo)
4. [Performance considerations](https://github.com/NETMF/llilum-pr/wiki/Performance-Considerations)
5. [Next steps](https://github.com/NETMF/llilum-pr/wiki/Prototype-Roadmap)
# Acknowledgments
A big thanks to Miguel Perez Martinez for helping bringing up this proof of concepts with exceptional dedication, perseverance and competency. An even bigger thanks to D.M., who created the vast majority of this codebase single-handedly.
================================================
FILE: SDKHelpers/RunLillium.cmd
================================================
%LLILUM_ROOT%ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Compiler.exe -cfg %LLILUM_ROOT%mbed_simple_LPC1768.FrontEndConfig .\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe -OutputName Microsoft.Zelig.Test.mbed.Simple -OutputDir output
================================================
FILE: SDKHelpers/output/CompileAndLink.bat
================================================
@echo off
IF %1.==. (
ECHO No target passed in. Defaulting to LPC1768
set TARGET=LPC1768
) ELSE (
ECHO Detected target: %1
set TARGET=%1
)
ECHO.
ECHO Linking with mbed libs...
make clean TARGET=%TARGET%
make TARGET=%TARGET%
GOTO :EXIT
:EXIT
ECHO.
ECHO Completed
================================================
FILE: SDKHelpers/output/RunLLVM.bat
================================================
@echo off
IF /i "%LLVM_BIN%"=="" (
ECHO LLVM_BIN is not defined. Please define LLVM_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
ECHO Running LLVM Optimization Phases...
::%LLVM_BIN%\opt -O2 -adce -globaldce Microsoft.Zelig.Test.mbed.Simple.bc -o Microsoft.Zelig.Test.mbed.Simple_opt.bc
::%LLVM_BIN%\opt -O1 -globalopt -constmerge -adce -globaldce -time-passes Microsoft.Zelig.Test.mbed.Simple.bc -o Microsoft.Zelig.Test.mbed.Simple_opt.bc
%LLVM_BIN%\opt -scalarrepl -targetlibinfo -verify -mem2reg -constmerge -adce -globaldce -time-passes Microsoft.Zelig.Test.mbed.Simple.bc -o Microsoft.Zelig.Test.mbed.Simple_opt.bc
::copy Microsoft.Zelig.Test.mbed.Simple.bc Microsoft.Zelig.Test.mbed.Simple_opt.bc
::%LLVM_BIN%\llvm-bcanalyzer Microsoft.Zelig.Test.mbed.Simple_opt.bc
%LLVM_BIN%\llvm-dis Microsoft.Zelig.Test.mbed.Simple_opt.bc
ECHO Compiling to ARM...
%LLVM_BIN%\llc -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF -o=Microsoft.Zelig.Test.mbed.Simple_opt.o Microsoft.Zelig.Test.mbed.Simple_opt.bc
ECHO Size Report...
%GCC_BIN%\arm-none-eabi-size.exe Microsoft.Zelig.Test.mbed.Simple_opt.o
:EXIT
ECHO.
ECHO Completed
================================================
FILE: SDKHelpers/output/makefile
================================================
#
# Project-specific settings
#
VERBOSE=1
PROJECT = mbed_simple
OBJECTS = .\Microsoft.Zelig.Test.mbed.Simple_opt.o $(TARGET)\temporary_helper.o
#
# Paths and includes
# TODO: Make this algorithmic based on TARGET.
#
ifndef TARGET
$(error TARGET is undefined. Pass in TARGET for desired board)
endif
ifeq ($(HARDFP),1)
FLOAT_ABI = hard
else
FLOAT_ABI = softfp
endif
# Common settings
GCC_BIN = ..\ARM_GCC\4.9\bin\\
MBED_ROOT = ..\mbed
LIBRARIES = -lmbed
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
# LPC1768 settings
ifeq ($(TARGET),LPC1768)
SYS_OBJECTS = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\board.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\startup_LPC17xx.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\cmsis_nvic.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\retarget.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\system_LPC17xx.o
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(MBED_ROOT)\TARGET_LPC1768 -I$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768
LIBRARY_PATHS = -L$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\LPC1768.ld
# Build flags
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_CORTEX_M -DTARGET_NXP -DTARGET_LPC176X -DTARGET_MBED_LPC1768 -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3 -DMBED_BUILD_TIMESTAMP=1435185689.48 -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
# K64F settings
else ifeq ($(TARGET),K64F)
SYS_OBJECTS = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/system_MK64F12.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/startup_MK64F12.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/retarget.o
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(MBED_ROOT)/TARGET_K64F -I$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common/phyksz8081 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lptmr -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dac -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/gpio -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/port -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/llwu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sim -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rcm -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sdhc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/can -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mpu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/smc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/osc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/flextimer -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pdb -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/i2c -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/uart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dspi -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lpuart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sai -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rtc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mcg -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/edma -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pmc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/wdog -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dmamux -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/utilities -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/interrupt -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock
LIBRARY_PATHS = -L$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld
# Build flags
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_K64F -DTARGET_M4 -DTARGET_CORTEX_M -DTARGET_Freescale -DTARGET_KPSDK_MCUS -DTARGET_KPSDK_CODE -DTARGET_MCU_K64F -DTARGET_FRDM -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M4 -DARM_MATH_CM4 -D__FPU_PRESENT=1 -DMBED_BUILD_TIMESTAMP=1435855534.71 -D__MBED__=1 -DCPU_MK64FN1M0VMD12 -DFSL_RTOS_MBED -DTARGET_FF_ARDUINO
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
else
$(error TARGET is not recognized. Please check the value passed in)
endif
DEPS = $(OBJECTS:.o=.d)
#
# Build tools
#
AS = "$(GCC_BIN)arm-none-eabi-as"
CC = "$(GCC_BIN)arm-none-eabi-gcc"
CPP = "$(GCC_BIN)arm-none-eabi-g++"
LD = "$(GCC_BIN)arm-none-eabi-gcc"
OBJCOPY = "$(GCC_BIN)arm-none-eabi-objcopy"
OBJDUMP = "$(GCC_BIN)arm-none-eabi-objdump"
SIZE = "$(GCC_BIN)arm-none-eabi-size"
ifeq ($(DEBUG), 1)
CC_FLAGS += -DDEBUG -O0
else
CC_FLAGS += -DNDEBUG -Os
endif
#
# Recipes
#
.PHONY: all clean lst size
all: ${TARGET} $(TARGET)\$(PROJECT).bin $(TARGET)\$(PROJECT).hex $(TARGET)\$(PROJECT).lst $(TARGET)\$(PROJECT).disasm size
# Conditionals (ifeq/ifneq) are bugged on Windows. Instead, we'll just ensure the directory exists and remove it unconditionally.
clean: ${TARGET}
@rmdir /q /s $(TARGET)
# Ensures the target directory has been created.
${TARGET}:
@mkdir $@
$(TARGET)\\%.o: %.s
$(AS) $(CPU) -o $@ $<
$(TARGET)\\%.o: %.c
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: %.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
$(TARGET)\$(PROJECT).bin: $(TARGET)\$(PROJECT).elf
$(OBJCOPY) -O binary $< $@
$(TARGET)\$(PROJECT).hex: $(TARGET)\$(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@
$(TARGET)\$(PROJECT).lst: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@
$(TARGET)\$(PROJECT).disasm: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -D $< > $@
size: $(TARGET)\$(PROJECT).elf
@echo Size report...
$(SIZE) $<
================================================
FILE: SDKHelpers/setenv.cmd
================================================
@echo off
set LLILUM_ROOT=%CD%\
echo Current dir is %LLILUM_ROOT%
prompt $_$+---$G $P$_$+ $G$_Cmd$G
::
:: Set LLVM environment variables.
::
set LLVM_BIN=%LLILUM_ROOT%LLVM\Debug\bin\
set GCC_BIN=%LLILUM_ROOT%ARM_GCC\4.9\bin\
::
:: Add pyOCD and and make to path.
::
set PATH=%LLILUM_ROOT%tools;%PATH%
echo Welcome to LLILUM!
echo --- NOTE ---
echo See SDKDrop\tools\readme.txt for the PY_OCD download link
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Managed/Managed.csproj
================================================
Debug
AnyCPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}
Exe
Properties
Managed
Llilum.Managed
v4.5
512
publish\
true
Disk
false
Foreground
7
Days
false
false
true
0
1.0.0.%2a
false
false
true
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
true
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Llilum.BoardConfigurations.K64F.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Llilum.BoardConfigurations.LPC1768.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\K64F.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\LPC1768.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.Support.mbed.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\System.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Windows.dll
False
Microsoft .NET Framework 4.5 %28x86 and x64%29
true
False
.NET Framework 3.5 SP1
false
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Managed/Program.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Managed
{
using Windows.Devices.Gpio;
using Windows.Devices.I2c;
using Windows.Devices.Enumeration;
// This is our board-specific assembly
using Microsoft.Llilum.LPC1768;
class Program
{
// This array will only have byte 0x0 in it
public static byte[] i2cReadWrite1 = new byte[] { 0x0 };
public static byte[] i2cReadWrite2 = new byte[] { 0x0, 0x0 };
//
// Set temperature range in order to filter bad readings.
//
private const double c_MinimumTemperature = 10.0;
private const double c_MaximumTemperature = 50.0;
// These are the pins on the LPC1768 dev board
static int[] pinNumbers =
{
(int)PinName.LED1,
(int)PinName.LED2,
(int)PinName.LED3,
(int)PinName.LED4,
};
///
/// Writes a command to the I2cDevice, then reads the result (temperature) and formats it
///
///
/// Temperature reading
public static double ReadTemp(I2cDevice device)
{
double temp;
i2cReadWrite1[0] = 0x0;
I2cTransferResult res = device.WriteReadPartial(i2cReadWrite1, i2cReadWrite2);
if (res.Status == I2cTransferStatus.SlaveAddressNotAcknowledged)
{
// Note: if you are running this sample where temp is < 0 degrees, you should probably relocate
// The board is not connected
temp = -1;
}
else
{
temp = ((i2cReadWrite2[0] << 8) | i2cReadWrite2[1]) / 256.0;
}
return temp;
}
private static double GetAveragedTemperature(int samples, I2cDevice i2cDevice)
{
double avg = 0.0;
for(int i=0; i c_MaximumTemperature)
{
tmp = ReadTemp( i2cDevice );
}
avg += tmp;
}
avg /= samples;
return avg;
}
static void Main()
{
var controller = GpioController.GetDefault();
var pins = new GpioPin[pinNumbers.Length];
const int c_SampleCount = 4;
for (int i = 0; i < pinNumbers.Length; ++i)
{
GpioPin pin = controller.OpenPin(pinNumbers[i]);
// Start with all LEDs off.
pin.Write(GpioPinValue.Low);
pin.SetDriveMode(GpioPinDriveMode.Output);
pins[i] = pin;
}
// Keep the first pin on, unless we hit an error
pins[0].Write(GpioPinValue.High);
// Initialize the I2cDevice
string i2cDeviceSelector = I2cDevice.GetDeviceSelector("I2C1");
var i2cAcqs = DeviceInformation.FindAllAsync(i2cDeviceSelector);
string i2cBusId = i2cAcqs[0].Id;
I2cDevice i2cDevice = I2cDevice.FromIdAsync(i2cBusId, new I2cConnectionSettings(slaveAddress: 0x90)
{
SharingMode = I2cSharingMode.Shared
});
//
// Get average starting temperature
//
double firstRead = GetAveragedTemperature(c_SampleCount, i2cDevice);
const double scale = 0.5;
while (true)
{
double tempDiff = GetAveragedTemperature(c_SampleCount, i2cDevice);
tempDiff -= firstRead;
pins[0].Write((tempDiff > 0 * scale) ? GpioPinValue.High : GpioPinValue.Low);
pins[1].Write((tempDiff > 1 * scale) ? GpioPinValue.High : GpioPinValue.Low);
pins[2].Write((tempDiff > 2 * scale) ? GpioPinValue.High : GpioPinValue.Low);
pins[3].Write((tempDiff > 3 * scale) ? GpioPinValue.High : GpioPinValue.Low);
}
}
}
}
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Managed/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Managed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Managed")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("982d03a1-c858-4b8f-8ff6-11e705f29a55")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Managed/README.txt
================================================
#
# Using this sample
#
This sample is built on top of the mBed Application Board, and uses the on-board I2C temperature sensor. Based on the temperature reading, LEDs on the LPC1768
board light up (the warmer, the more LEDs light up). Users can make the temperature "change" by placing a finger on the temperature sensor. If no LEDs light up,
change the values for TEMP0-3 to be tailored to the user's environment
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/Native.vcxproj
================================================
Debug
ARM
Release
ARM
{2a3586b9-7f8b-4215-943f-d7ecc81dbd8f}
Android
Native
14.0
Llilum
1.0
$(LLILUM_GCC)
Native
LPC1768
$(MSBuildProjectDirectory)\mbed_simple_$(LlilumBoardName).FrontEndConfig
$(LlilumSDK)source\ports\mbed\inc;$(LlilumSDK)source\inc;$(LlilumSDK)source\inc\api;$(LlilumSDK)source\inc\api\io;$(LlilumSDK)source\inc\hal
$(LlilumClAdditionalOptionsLPC1768)
$(LlilumClAdditionalIncludesLPC1768)
$(LlilumClPreprocessorDefsLPC1768)
$(LlilumLinkAdditionalDepsLPC1768)
$(LlilumLinkAdditionalLibDirsLPC1768)
$(LlilumLinkAdditionalOptionsLPC1768)
$(LlilumLinkLibDepsLPC1768)
$(LlilumTargetBoardArchitectureLPC1768)
$(LlilumAsmAdditionalOptionsLPC1768)
$(LlilumStackSizeLPC1768)
$(LlilumHeapSizeLPC1768)
$(LlilumClAdditionalOptionsK64F)
$(LlilumClAdditionalIncludesK64F)
$(LlilumClPreprocessorDefsK64F)
$(LlilumLinkAdditionalDepsK64F)
$(LlilumLinkAdditionalLibDirsK64F)
$(LlilumLinkAdditionalOptionsK64F)
$(LlilumLinkLibDepsK64F)
$(LlilumTargetBoardArchitectureK64F)
$(LlilumAsmAdditionalOptionsK64F)
$(LlilumStackSizeK64F)
$(LlilumHeapSizeK64F)
$(LlilumClAdditionalOptionsSTM32L152)
$(LlilumClAdditionalIncludesSTM32L152)
$(LlilumClPreprocessorDefsSTM32L152)
$(LlilumLinkAdditionalDepsSTM32L152)
$(LlilumLinkAdditionalLibDirsSTM32L152)
$(LlilumLinkAdditionalOptionsSTM32L152)
$(LlilumLinkLibDepsSTM32L152)
$(LlilumTargetBoardArchitectureSTM32L152)
$(LlilumAsmAdditionalOptionsSTM32L152)
$(LlilumStackSizeSTM32L152)
$(LlilumHeapSizeSTM32L152)
DynamicLibrary
true
$(LlilumTargetBoardArchitecture)
DynamicLibrary
$(LlilumTargetBoardArchitecture)
system
false
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);DEBUG;%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
{34eeeced-afb0-4717-8212-d7f6dc103896}
true
true
true
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/Source.cpp
================================================
extern "C"
{
// User's C interop code goes here
// Dummy function used in Program.cs as an example
int AddOneInterop(int input)
{
return input + 1;
}
}
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/mbed_simple_K64F.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference K64F
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#-OutputName Microsoft.Zelig.Test.mbed.Simple
#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/mbed_simple_LPC1768.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetup Microsoft.Llilum.BoardConfigurations.LPC1768MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference LPC1768
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#-OutputName Microsoft.Zelig.Test.mbed.Simple
#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/mbed_simple_STM32L152.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32L152.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32L152MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference STM32L152
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
-OutputName Microsoft.Zelig.Test.mbed.Simple
-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
-DumpLLVMIR_TextRepresentation
-MaxProcs 8
-NoSDK
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor/Native/pch.h
================================================
================================================
FILE: Samples/I2cTemperatureSensor/I2cTemperatureSensor.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Native", "I2cTemperatureSensor\Native\Native.vcxproj", "{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Managed", "I2cTemperatureSensor\Managed\Managed.csproj", "{82477C67-5E33-437A-9AE5-33F9808CC9F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Debug|Any CPU.ActiveCfg = Debug|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Debug|ARM.ActiveCfg = Debug|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Debug|ARM.Build.0 = Debug|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Debug|ARM.Deploy.0 = Debug|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Release|Any CPU.ActiveCfg = Release|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Release|ARM.ActiveCfg = Release|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Release|ARM.Build.0 = Release|ARM
{2A3586B9-7F8B-4215-943F-D7ECC81DBD8F}.Release|ARM.Deploy.0 = Release|ARM
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Debug|ARM.ActiveCfg = Debug|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Debug|ARM.Build.0 = Debug|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Release|Any CPU.Build.0 = Release|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Release|ARM.ActiveCfg = Release|Any CPU
{82477C67-5E33-437A-9AE5-33F9808CC9F3}.Release|ARM.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: Samples/README.txt
================================================
Below is the list of samples in this directory. Each item lists the sample name,
the MCU it is implemented for, and any other requirements for it to run correctly.
Many of these rely on the mBed Application board, which can be found here: https://developer.mbed.org/cookbook/mbed-application-board
Sample Name | MCU | Additional Requirements | Details
============================================================================================================================
Spi Display | LPC1768 | mBed Application Board | Modifying board config; SPI; ADC; managed driver
I2c Temperature Sensor | LPC1768 | mBed Application Board | I2C; GPIO
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Managed/Managed.csproj
================================================
Debug
AnyCPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}
Exe
Properties
Managed
Llilum.Managed
v4.5
512
publish\
true
Disk
false
Foreground
7
Days
false
false
true
0
1.0.0.%2a
false
false
true
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
true
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.Support.mbed.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\LPC1768.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\System.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Windows.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Llilum.BoardConfigurations.LPC1768.dll
False
Microsoft .NET Framework 4.5 %28x86 and x64%29
true
False
.NET Framework 3.5 SP1
false
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Managed/Program.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Test.mbed.Simple
{
using Windows.Devices.Adc;
using Windows.Devices.Gpio;
using Windows.Devices.Spi;
using Windows.Devices.Enumeration;
// This is our board-specific assembly
using Llilum.LPC1768;
///
/// This is a sample program to show the functionality of the SPI controller implementation. This demonstrates the power of
/// writing managed drivers, and the ability to interact with C functions through managed code. This demo is intended to
/// be run on a LPC1768 board on the mBed application board (https://developer.mbed.org/cookbook/mbed-application-board)
///
unsafe class Program
{
static AdcChannel adcChannel;
static SpiDevice spiDevice;
static GpioPin _A0, _reset, _CS;
// This is the figure we will be drawing
static byte[] stickFigure = new byte[]
{0x00, 0x00, 0xF0, 0x9C, 0x06, 0xC2, 0x93, 0x01, 0x01, 0x93, 0xC2, 0x06, 0x9C, 0xF0, 0x00, 0x00,
0x10, 0x10, 0x20, 0x23, 0x46, 0x44, 0x8C, 0xF9, 0xF9, 0x8C, 0x44, 0x46, 0x23, 0x20, 0x10, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7F, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x01, 0x00, 0x00, 0x01, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00};
static byte[] writeHelper;
static void Main()
{
var controller = GpioController.GetDefault();
// Used to pass data to SPI device
writeHelper = new byte[1];
_A0 = controller.OpenPin((int)PinName.p8);
_A0.SetDriveMode(GpioPinDriveMode.Output);
_reset = controller.OpenPin((int)PinName.p6);
// Start reset high
_reset.Write(GpioPinValue.High);
_reset.SetDriveMode(GpioPinDriveMode.Output);
_CS = controller.OpenPin((int)PinName.p11);
_CS.Write(GpioPinValue.High);
_CS.SetDriveMode(GpioPinDriveMode.Output);
// Analog pin init. This maps to LPC1768 p19
adcChannel = AdcController.GetDefaultAsync().OpenChannel(4);
// Note: The LCD display uses a non-standard SPI configuration. This is why we
// have added a copy of the LPC1768 project, and changed the configuration for SPI0!
// Get the device selector by friendly name
string deviceSelector = SpiDevice.GetDeviceSelector("SPI0WriteOnly");
var acqs = DeviceInformation.FindAllAsync(deviceSelector);
string busId = acqs[0].Id;
// Set up a non-default frequency and pins
int chipSelect = unchecked((int)PinName.NC);
SpiConnectionSettings settings = new SpiConnectionSettings(chipSelect)
{
ClockFrequency = 20000000,
Mode = SpiMode.Mode3
};
// Get a reference to the SPI device
spiDevice = SpiDevice.FromIdAsync(busId, settings);
// Initialize the LCD display
lcd_reset();
int width = 16;
while (true)
{
int analogVal = (int)(adcChannel.ReadRatio() * 100);
if (analogVal > 112)
{
analogVal = 112;
}
else if (analogVal < 0)
{
analogVal = 0;
}
copy_to_lcd(analogVal, analogVal + width);
}
}
///
/// LCD Initializer
///
private static void lcd_reset()
{
_A0.Write(GpioPinValue.Low);
_CS.Write(GpioPinValue.High);
_reset.Write(GpioPinValue.Low);
for (int i = 0; i < 500; i++)
{
// Wait 50ms
}
// Try to force low...
_reset.Write(GpioPinValue.High);
for (int i = 0; i < 50; i++)
{
// Wait 5ms
}
wr_cmd(0xAE); // display off
wr_cmd(0xA2); // bias voltage
wr_cmd(0xA0);
wr_cmd(0xC8); // column normal
wr_cmd(0x22); // voltage resistor ratio
wr_cmd(0x2F); // power on
//wr_cmd(0xA4); // LCD display ram
wr_cmd(0x40); // start line = 0
wr_cmd(0xAF); // display ON
wr_cmd(0x81); // set contrast
wr_cmd(0x17); // set contrast
wr_cmd(0xA6); // display normal
copy_to_lcd(-1, -1);
}
///
/// Write a single byte command to the LCD display
///
///
private static void wr_cmd(byte a)
{
writeHelper[0] = a;
_A0.Write(GpioPinValue.Low);
_CS.Write(GpioPinValue.Low);
spiDevice.Write(writeHelper);
_CS.Write(GpioPinValue.High);
}
///
/// Write a single byte data to the LCD display
///
///
private static void wr_dat(byte a)
{
writeHelper[0] = a;
_A0.Write(GpioPinValue.High);
_CS.Write(GpioPinValue.Low);
spiDevice.Write(writeHelper);
}
///
/// Flush the LCD display. Draw a figure from startIndex to stopIndex.
///
/// Begin drawing
/// End drawing
private static void copy_to_lcd(int startIndex, int stopIndex)
{
int i = 0;
int j = 0;
//page 0
wr_cmd(0x00); // set column low nibble 0
wr_cmd(0x10); // set column hi nibble 0
wr_cmd(0xB0); // set page address 0
_A0.Write(GpioPinValue.High);
for (i = 0; i < 128; i++)
{
if (i >= startIndex && i < stopIndex)
{
wr_dat(stickFigure[j]);
j++;
}
else
{
wr_dat(0x00);
}
}
// page 1
wr_cmd(0x00); // set column low nibble 0
wr_cmd(0x10); // set column hi nibble 0
wr_cmd(0xB1); // set page address 1
_A0.Write(GpioPinValue.High);
for (i = 0; i < 128; i++)
{
if (i >= startIndex && i < stopIndex)
{
wr_dat(stickFigure[j]);
j++;
}
else
{
wr_dat(0x00);
}
}
//page 2
wr_cmd(0x00); // set column low nibble 0
wr_cmd(0x10); // set column hi nibble 0
wr_cmd(0xB2); // set page address 2
_A0.Write(GpioPinValue.High);
for (i = 0; i < 128; i++)
{
if (i >= startIndex && i < stopIndex)
{
wr_dat(stickFigure[j]);
j++;
}
else
{
wr_dat(0x00);
}
}
//page 3
wr_cmd(0x00); // set column low nibble 0
wr_cmd(0x10); // set column hi nibble 0
wr_cmd(0xB3); // set page address 3
_A0.Write(GpioPinValue.High);
// Why is this here?
//_CS.Write(GpioPinValue.Low);
for (i = 0; i < 128; i++)
{
if (i >= startIndex && i < stopIndex)
{
wr_dat(stickFigure[j]);
j++;
}
else
{
wr_dat(0x00);
}
}
}
}
}
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Managed/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Managed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Managed")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("66e1e899-ba49-4bf4-bb74-f9b3b74a87ec")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Managed/README.txt
================================================
#
# Using a modified board configuration
#
The mbed Application Board has a SPI display connected to SPI0. The MISO and CS pins, however,
are not connected as SPI pins; they are mapped to _reset and _A0, respectively.
In order to ensure that the MISO and CS pins are not reserved by the SpiDevice, we must modify
the board configuration assembly (LPC1768.dll) and create a new one (LPC1768ApplicationBoard.dll).
Below are the steps for how we accomplished that goal:
1. Copy the LPC1768 project from Zelig\Runtime\DeviceModels\CortexM\Boards to the Solution Dir.
2. Add the copied project to the solution, rename it, and rename its assembly in AssemblyInfo.cs
3. Edit the project properties so that build output goes to SDKDrop\ZeligBuild\Target\bin\Debug\
4. Resolve any reference issues, and ensure that all DLLs are in SDKDrop\ZeligBuild\Target\bin\Debug\
5. Change the LPC1768 reference in the Managed project to LPC1768ApplicationBoard
6. Ensure that the managed projects build correctly
7. In mbed_simple_LPC1768.FrontEndConfig, change "-Reference LPC1768" to "-Reference LPC1768ApplicationBoard"
8. Rebuild the entire solution
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/Native.vcxproj
================================================
Debug
ARM
Release
ARM
{d8dca8c9-9d56-4f97-b5fa-d26ed0944400}
Android
Native
14.0
Llilum
1.0
$(LLILUM_GCC)
Native
LPC1768
$(MSBuildProjectDirectory)\mbed_simple_$(LlilumBoardName).FrontEndConfig
$(LlilumSDK)source\ports\mbed\inc;$(LlilumSDK)source\inc;$(LlilumSDK)source\inc\api;$(LlilumSDK)source\inc\api\io;$(LlilumSDK)source\inc\hal
$(LlilumClAdditionalOptionsLPC1768)
$(LlilumClAdditionalIncludesLPC1768)
$(LlilumClPreprocessorDefsLPC1768)
$(LlilumLinkAdditionalDepsLPC1768)
$(LlilumLinkAdditionalLibDirsLPC1768)
$(LlilumLinkAdditionalOptionsLPC1768)
$(LlilumLinkLibDepsLPC1768)
$(LlilumTargetBoardArchitectureLPC1768)
$(LlilumAsmAdditionalOptionsLPC1768)
$(LlilumStackSizeLPC1768)
$(LlilumHeapSizeLPC1768)
$(LlilumClAdditionalOptionsK64F)
$(LlilumClAdditionalIncludesK64F)
$(LlilumClPreprocessorDefsK64F)
$(LlilumLinkAdditionalDepsK64F)
$(LlilumLinkAdditionalLibDirsK64F)
$(LlilumLinkAdditionalOptionsK64F)
$(LlilumLinkLibDepsK64F)
$(LlilumTargetBoardArchitectureK64F)
$(LlilumAsmAdditionalOptionsK64F)
$(LlilumStackSizeK64F)
$(LlilumHeapSizeK64F)
$(LlilumClAdditionalOptionsSTM32L152)
$(LlilumClAdditionalIncludesSTM32L152)
$(LlilumClPreprocessorDefsSTM32L152)
$(LlilumLinkAdditionalDepsSTM32L152)
$(LlilumLinkAdditionalLibDirsSTM32L152)
$(LlilumLinkAdditionalOptionsSTM32L152)
$(LlilumLinkLibDepsSTM32L152)
$(LlilumTargetBoardArchitectureSTM32L152)
$(LlilumAsmAdditionalOptionsSTM32L152)
$(LlilumStackSizeSTM32L152)
$(LlilumHeapSizeSTM32L152)
DynamicLibrary
true
$(LlilumTargetBoardArchitecture)
DynamicLibrary
$(LlilumTargetBoardArchitecture)
system
false
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);DEBUG;%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
{b82b6a0e-fe0c-4ad7-bd33-525508a987b1}
true
true
true
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/Source.cpp
================================================
extern "C"
{
// User's C interop code goes here
// Dummy function used in Program.cs as an example
int AddOneInterop(int input)
{
return input + 1;
}
}
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/mbed_simple_K64F.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference K64F
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#-OutputName Microsoft.Zelig.Test.mbed.Simple
#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/mbed_simple_LPC1768.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetup Microsoft.Llilum.BoardConfigurations.LPC1768MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference LPC1768
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#-OutputName Microsoft.Zelig.Test.mbed.Simple
#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/mbed_simple_STM32L152.FrontEndConfig
================================================
###
### Location of the Zelig assemblies.
###
-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32L152.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32L152MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference STM32L152
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
-OutputName Microsoft.Zelig.Test.mbed.Simple
-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
-DumpLLVMIR_TextRepresentation
-MaxProcs 8
-NoSDK
================================================
FILE: Samples/SpiDisplay/SpiDisplay/Native/pch.h
================================================
================================================
FILE: Samples/SpiDisplay/SpiDisplay.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Native", "SpiDisplay\Native\Native.vcxproj", "{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Managed", "SpiDisplay\Managed\Managed.csproj", "{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Debug|Any CPU.ActiveCfg = Debug|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Debug|ARM.ActiveCfg = Debug|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Debug|ARM.Build.0 = Debug|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Debug|ARM.Deploy.0 = Debug|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Release|Any CPU.ActiveCfg = Release|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Release|ARM.ActiveCfg = Release|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Release|ARM.Build.0 = Release|ARM
{D8DCA8C9-9D56-4F97-B5FA-D26ED0944400}.Release|ARM.Deploy.0 = Release|ARM
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Debug|ARM.Build.0 = Debug|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Release|Any CPU.Build.0 = Release|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Release|ARM.ActiveCfg = Release|Any CPU
{2F9DF480-AFDB-482D-87BB-5CB82E03A43F}.Release|ARM.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/AndroidDebugger.xml
================================================
FEEA6E9D-77D8-423F-9EDE-3970CBB76125
0x400
AndroidDeviceID
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/Llilum.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/ar.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/as.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/clang.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/clanglink.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/general_android.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/general_makefile_android.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/1033/nmake_android.xml
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.Common.props
================================================
x64
x86
Native32Bit
true
false
$(IntermediateOutputPath)
$(Platform)\$(Configuration)\
$(IntDir)
$(SolutionDir)$(Platform)\$(Configuration)\
false
false
Unicode
<_PlatformToolsetShortNameFor_Clang_3_4>$(TargetOsAndVersion)
<_PlatformToolsetFriendlyNameFor_Clang_3_4 Condition="'$(_PlatformToolsetFriendlyNameFor_Clang_3_4)' == ''">Clang 3.4
<_PlatformToolsetShortNameFor_Gcc>$(TargetOsAndVersion)
<_PlatformToolsetFriendlyNameFor_Gcc Condition="'$(_PlatformToolsetFriendlyNameFor_Gcc)' == ''">GCC
$(MSBuildProjectName)
*.bin;*.hex;*.lst;*.d;*.tlog;$(ExtensionsToDeleteOnClean)
true
true
true
"$(VS_NdkRoot)\ndk-build.cmd"
"$(VS_NdkRoot)\ndk-build.cmd" -B
"$(VS_NdkRoot)\ndk-build.cmd" clean
true
true
.so
library
lib$(RootNamespace)
true
.a
staticlibrary
lib$(RootNamespace)
VCInstallDir_is_not_defined
WindowsSdkDir_is_not_defined
<_CheckDev11ToolsInstalled>false
Performing Custom Build Tools
true
false
$(TLogLocation)
true
$(AcceptableNonZeroExitCodes)
Performing Custom Build Step
false
true
false
true
true
EnableAllWarnings
FullDebug
None
NDEBUG;%(PreprocessorDefinitions)
Disabled
MinSize
$(IntDir)
Disabled
false
gnu99
gnu++98
NotUsing
$(IntDir)%(filename).o
Default
false
false
false
true
$(IntDir)
CompileAsCpp
true
true
true
false
false
false
false
false
false
false
true
$(OutDir)$(TargetName)$(TargetExt)
true
false
$(OutDir)$(TargetName)$(TargetExt)
Replacement
true
--strip-unneeded $(StripOptions)
false
LlilumDebugger
false
false
BreadthFirst
{F8BBB05E-FBD0-4B36-8C17-0B3F79AD4F01}
$(NMakeIncludeSearchPath);$(VS_NDKRoot)\platforms\$(AndroidAPILevel)\arch-$(Platform)\usr\include;$(VS_NDKRoot)\sources\android\ndk_helper;$(VS_NDKRoot)\sources\android\cpufeatures;$(VS_NDKRoot)\sources\android\native_app_glue;$(StlIncludeDirectories)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.Common.targets
================================================
%(Link.OutputFile)
<_ApkRecipeFile>$(OutDir)$(TargetName)$(TargetExt).recipe
Low
$(ComputeCompileInputsTargets);
FixupCLCompileOptions;
%(ClCompile.ForcedIncludeFiles)
false
EnableAllWarnings
CompileAsC
CompileAsCpp
%(ClCompile.PrecompiledHeaderOutputFileDirectory)\
$([System.IO.Path]::GetFileName('%(ClCompile.PrecompiledHeaderFile)'))
%(ClCompile.PrecompiledHeaderFile);%(ClCompile.ForcedIncludeFiles)
%(ClCompile.PrecompiledHeaderOutputFileDirectory)%(ClCompile.PrecompiledHeaderOutputFileName)
%(ClCompile.PrecompiledHeaderOutputFileDirectory)%(ClCompile.PrecompiledHeaderOutputFileName).gch
%(ClCompile.PrecompiledHeaderOutputFileDirectory)%(ClCompile.PrecompiledHeaderOutputFileName);%(ClCompile.ClangForcedIncludeFiles)
-mcpu=$(ArmArchitecture) %(AdditionalOptions)
$(VCToolArchitecture)
true
false
-mcpu=$(ArmArchitecture) %(AdditionalOptions)
-mthumb %(AdditionalOptions)
$(VCToolArchitecture)
$(IntDir.TrimEnd('\'))
-CompilationSetupPath "$(LlilumBoardSupportPackage)"
-CompilationSetupPath "$(LlilumSDK)CompilationSetup\Microsoft.Llilum.BoardConfigurations.$(LlilumBoardName).dll"
$(AfterBuildLinkTargets);dotbin;dothex;dotlst;size
$(BuildCompileTargets);ConvertManagedCode
ComputeCLOutputFromManagedCode;$(ComputeLinkInputsTargets)
ComputeCLOutputFromManagedCode;$(ComputeLibInputsTargets)
$(ToolchainPrefix)ar.exe
$(VCToolArchitecture)
false
<_ObjDirectories Condition="'@(Obj)'!=''">$([System.IO.Path]::GetDirectoryName('%(Obj.fullpath)'))
o
$(ConfigurationType)
$(_ApkRecipeFile)
$(_ApkRecipeFile)
<_MSBuildProjectReferenceExistent Include="@(_MSBuildProjectReferenceExistent)">
Android
$(BeforeBuildCompileTargets);
_AssignProjectReferencesPlatformType;
$(BuildLinkTargets);
_CreateApkRecipeFile;
_MarkLastSuccessfulDeployForCleanup;
Project
PropertySheet
File;BrowseObject
$(OutDir)\$([System.IO.Path]::GetFileNameWithoutExtension('$(PackagePath)')).lastsuccessfuldeploy
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.Makefile.targets
================================================
<_MSBuildProjectReferenceExistent>
Android
o
$(ConfigurationType)
false
$(OutDir)$(ProjectName).recipe
Project
PropertySheet
File
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.NDK.props
================================================
x86
i686-linux-android-
arm-none-eabi
arm-none-eabi-
4.9.3
$(ToolchainPrebuiltPath)\$(ToolchainName)\lib
$(ToolchainPrefix)objcopy
$(ToolchainPrefix)objdump
$(ToolchainPrefix)size
android-arm
android-x86
gdbserver
$(VS_NdkRoot)\prebuilt\$(GdbPrebuiltTag)\gdbserver\$(GdbServerName)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.STL.props
================================================
<_PropertySheetDisplayName>Use of STL
$(VS_NdkRoot)\platforms\$(AndroidAPILevel)\arch-arm\usr\lib\libstdc++.a
$(VS_NdkRoot)\platforms\$(AndroidAPILevel)\arch-x86\usr\lib\libstdc++.a
stdc++
true
$(VS_NdkRoot)\sources\cxx-stl\gabi++\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\gabi++\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\stlport\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\stlport\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libs\$(TargetArchAbi)\thumb
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libs\$(TargetArchAbi)\thumb
$(UseOfStl)
true
$(VS_NdkRoot)\sources\cxx-stl\gabi++\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\gabi++\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\stlport\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\stlport\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libs\$(TargetArchAbi)
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libs\$(TargetArchAbi)
$(UseOfStl)
true
$(StlLibraryPath)\lib$(StlLibraryName).a
$(StlLibraryPath)\lib$(StlLibraryName).so
$(VS_NdkRoot)\sources\cxx-stl\system\include
$(VS_NdkRoot)\sources\cxx-stl\gabi++\include
$(VS_NdkRoot)\sources\cxx-stl\stlport\stlport;$(VS_NdkRoot)sources\cxx-stl\gabi++\include
$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\include;$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\libs\$(TargetArchAbi)\include;$(VS_NdkRoot)\sources\cxx-stl\gnu-libstdc++\$(ToolchainVersion)\include\backward
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libcxx\include;$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++abi\libcxxabi\include
$(VS_NdkRoot)\sources\cxx-stl\llvm-libc++\libcxx\include;$(VS_NdkRoot)\sources\cxx-stl\gabi++\include
c++11
false
$(StlAdditionalDependencies)
$(StlIncludeDirectories)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Android.Tools.props
================================================
$(Registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\SecondaryInstaller\VC@AndroidHome)
$(Registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\SecondaryInstaller\VC@AntHome)
$(Registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\SecondaryInstaller\VC@JavaHome)
$(Registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\SecondaryInstaller\VC@NDKRoot)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Android SDK Tools@Path)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools@Path)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VS\SecondaryInstaller\Ant@ANT_HOME)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\Setup\VS\SecondaryInstaller\Ant@ANT_HOME)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.7\@JavaHome)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit\1.7\@JavaHome)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VS\SecondaryInstaller\AndroidNDK@NDK_HOME)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\Setup\VS\SecondaryInstaller\AndroidNDK@NDK_HOME)
$(VS_NdkRoot)\Platforms
$(VS_AndroidHome)\Platforms
High
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$(DefaultAndroidAPILevelNumber)
$(AndroidAPILevelNumber).0
Cupcake 1.5
Donut 1.6
Eclair 2.0
Eclair 2.0.1
Eclair 2.1
Froyo 2.2.x
Gingerbread 2.3 - 2.3.2
Gingerbread 2.3.3 - 2.3.7
Honeycomb 3.0
Honeycomb 3.1
Honeycomb 3.2.x
Ice Cream Sandwich 4.0.1 - 4.0.2
Ice Cream Sandwich 4.0.3 - 4.0.4
Jelly Bean 4.1.x
Jelly Bean 4.2.x
Jelly Bean 4.3.x
KitKat 4.4 - 4.4.4
Lollipop 5.0 - 5.0.2
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Default.props
================================================
$(VCTargetsPath)\Application Type\$(ApplicationType)\$(ApplicationTypeRevision)\
Gcc
Gcc
$(AndroidCommonTargetsPath)\Android.NDK.Props
android-19
19
gnustl_static
DynamicLibrary
armv7-m
armv6-m;armv7-ar;armv7e-m;armv7-m;cortex-m7;cortex-m3;cortex-m4
$(MSBuildExtensionsPath)\Microsoft.Cpp\v4.0\V140\Application Type\Llilum\1.0\
$(LLILUM_SDK)
$(LLILUM_LLVM)build\x64\Debug\bin\
$(LlilumSDK)mbed\
LPC1768
TARGET_LPC1768
TARGET_NXP
TOOLCHAIN_GCC_ARM
TARGET_LPC176X
TARGET_MBED_LPC1768
$(SolutionName)
$(LLILUM_GCC)\bin\
$(OutDir)\$(LlilumOutputName).bin
$(LlilumSDK)os_layer\
$(LlilumSDK)\bin\Microsoft.Zelig.Compiler.exe
$(MSBuildProjectDirectory)\mbed_simple_$(LlilumBoardName).FrontEndConfig
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/Platform.Default.props
================================================
ARM
ARM
ARM
armeabi-v7a
Thumb
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/Platform.props
================================================
<_PlatformFolder>$(MSBuildThisFileDirectory)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/Platform.targets
================================================
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/PlatformToolsets/Gcc/ImportAfter/armasm.props
================================================
$(ToolchainPrefix)as
$(IntDir)%(FileName).o
--gen-debug -mcpu=cortex-m3 -mthumb
false
as [AllOptions] [AdditionalOptions] [Inputs]
Assembling %(Identity)...
ArmAssemble
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/PlatformToolsets/Gcc/ImportAfter/armasm.targets
================================================
$(ComputeLinkInputsTargets);
ComputeARMASMOutput;
$(ComputeLibInputsTargets);
ComputeARMASMOutput;
false
@(ArmAssemble, '|')
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/PlatformToolsets/Gcc/Toolset.props
================================================
$(ToolchainPrefix)gcc.exe
true
false
4.9.3
$(ToolchainPrebuiltPath)\bin;$(LlilumLLVM);$(ExecutablePath)
$(ToolchainPrebuiltPath)\$(ToolchainName)\include\c++\$(ToolchainVersion)\$(ToolchainName)\$(ArmArchitecture);$(ToolchainPrebuiltPath)\$(ToolchainName)\include\c++\$(ToolchainVersion)\$(ToolchainName);$(ToolchainPrebuiltPath)\$(ToolchainName)\include\c++\$(ToolchainVersion);$(ToolchainPrebuiltPath)\$(ToolchainName)\include;$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(GccVersion)\include-fixed;$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(GccVersion)\include
$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(GccVersion)\include;$(MSBuildToolsPath);$(MSBuildFrameworkToolsPath);$(MSBuild_ExecutablePath)
$(StlIncludeDirectories);%(AdditionalIncludeDirectories)
$(ThumbMode)
false
$(StlLibraryName);%(LibraryDependencies)
$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(GccVersion)\$(ArmArchitecture);$(StlLibraryPath);%(AdditionalLibraryDirectories)
%(SharedLibrarySearchPath)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/ARM/PlatformToolsets/Gcc/Toolset.targets
================================================
false
<_ApplicableDebuggers>Desktop
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_K64F.props
================================================
$(LlilumSDK)mbed\
TARGET_K64F
TARGET_Freescale
TOOLCHAIN_GCC_ARM
TARGET_KPSDK_MCUS
TARGET_MCU_K64F
cortex-m4
$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetBrandK64F)/$(LlilumTargetClassK64F)/
$(LlilumSDK)lwip\lwip;$(LlilumSDK)lwip\lwip\include;$(LlilumSDK)lwip\lwip\include\ipv4;$(LlilumSDK)lwip\lwip\include\ipv4\lwip;$(LlilumSDK)lwip\lwip\include\lwip;$(LlilumSDK)lwip\lwip\include\netif;$(LlilumSDK)lwip\lwip\netif;$(LlilumSDK)lwip/lwip/netif/ppp;$(LlilumSDK)lwip/lwip/api;$(LlilumSDK)lwip/lwip/core;$(LlilumSDK)lwip/lwip/core/ipv4;$(LlilumSDK)lwip/lwip/core/snmp;$(LlilumSDK)lwip/lwip-eth;$(LlilumSDK)lwip/lwip-eth/arch;$(LlilumSDK)lwip/lwip-sys;$(LlilumSDK)lwip/lwip-sys/arch;$(LlilumSDK)/mbed-rtos/llos;$(LlilumSDK)mbed-rtos/llos/TARGET_CORTEX_M;$(LlilumSDK)lwip/lwip-eth/arch/TARGET_Freescale;$(LlilumSDK)mbed-rtos\rtx\TARGET_CORTEX_M
-mcpu=$(LlilumTargetBoardArchitectureK64F) -mfloat-abi=softfp
$(LlilumTargetDirK64F);$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F);$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F);$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetBrandK64F);$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetBrandK64F)/$(LlilumTargetClassK64F);$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetBrandK64F)/$(LlilumTargetClassK64F)/$(LlilumTargetBoardMbedK64F);$(LlilumSDK)ARM_GCC\arm-none-eabi\include;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\device\device\MK64F12;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\device\device;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\device\MK64F12;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\MK64F12;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\TARGET_FRDM;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\utilities;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\wdog;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\uart;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\smc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\sim;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\sdhc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\sai;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\rtc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\rcm;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\port;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\pmc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\pit;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\pdb;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\osc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\mpu;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\mcg;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\lpuart;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\lptmr;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\llwu;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\i2c;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\gpio;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\flextimer;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\enet;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\edma;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\dspi;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\dmamux;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\dac;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\can;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal\adc;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\hal;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers\pit\common;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers\pit;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers\interrupt;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers\enet;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers\clock;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\drivers;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\common\phyksz8081;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE\common;$(LlilumTargetDivergingDirectoryK64F)TARGET_KPSDK_CODE;$(LlilumTargetDivergingDirectoryK64F)TARGET_MCU_K64F\device;$(LlilumTargetDirK64F)\EthernetInterface;$(LlilumLwipIncludeDirs)
TARGET_K64F;TARGET_M4;TARGET_CORTEX_M;TARGET_Freescale;TARGET_KPSDK_MCUS;TARGET_KPSDK_CODE;TARGET_MCU_K64F;TARGET_FRDM;TOOLCHAIN_GCC_ARM;TOOLCHAIN_GCC;__CORTEX_M4;ARM_MATH_CM4;__FPU_PRESENT=1;MBED_BUILD_TIMESTAMP=1435855534.71;__MBED__=1;CPU_MK64FN1M0VMD12;FSL_RTOS_MBED;TARGET_FF_ARDUINO;
$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F)/board.o;$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F)/cmsis_nvic.o;$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F)/retarget.o;$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F)/system_MK64F12.o
$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F);$(LlilumSDK)lwip\lwip\lib;
-T"$(LlilumTargetDirK64F)$(LlilumTargetBoardK64F)/$(LlilumTargetToolchainK64F)/K64FN1M0xxx12.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
lwipsysarch;mbedeth;lwIPeth;lwip;mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x10000
$(LlilumTargetDirK64F)
$(LlilumTargetBoardK64F)
$(LlilumTargetBrandK64F)
$(LlilumTargetToolchainK64F)
$(LlilumTargetClassK64F)
$(LlilumTargetBoardMbedK64F)
$(LlilumTargetBoardArchitectureK64F)
$(LlilumTargetDivergingDirectoryK64F)
$(LlilumLwipIncludeDirs)
$(LlilumClAdditionalOptionsK64F)
$(LlilumClAdditionalIncludesK64F)
$(LlilumClPreprocessorDefsK64F)
$(LlilumLinkAdditionalDepsK64F)
$(LlilumLinkAdditionalLibDirsK64F)
$(LlilumLinkAdditionalOptionsK64F)
$(LlilumLinkLibDepsK64F)
$(LlilumAsmAdditionalOptionsK64F)
$(LlilumStackSizeK64F)
$(LlilumHeapSizeK64F)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_LPC1768.props
================================================
$(LlilumSDK)mbed\
TARGET_LPC1768
TARGET_NXP
TOOLCHAIN_GCC_ARM
TARGET_LPC176X
TARGET_MBED_LPC1768
cortex-m3
$(LlilumTargetDirLPC1768)EthernetInterface;$(LlilumSDK)lwip\lwip;$(LlilumSDK)lwip\lwip\include;$(LlilumSDK)lwip\lwip\include\ipv4;$(LlilumSDK)lwip\lwip\include\ipv4\lwip;$(LlilumSDK)lwip\lwip\include\lwip;$(LlilumSDK)lwip\lwip\include\netif;$(LlilumSDK)lwip\lwip\netif;$(LlilumSDK)lwip/lwip/netif/ppp;$(LlilumSDK)lwip/lwip/api;$(LlilumSDK)lwip/lwip/core;$(LlilumSDK)lwip/lwip/core/ipv4;$(LlilumSDK)lwip/lwip/core/snmp;$(LlilumSDK)lwip/lwip-eth;$(LlilumSDK)lwip/lwip-eth/arch;$(LlilumSDK)lwip/lwip-sys;$(LlilumSDK)lwip/lwip-sys/arch;$(LlilumSDK)mbed-rtos/llos;$(LlilumSDK)mbed-rtos/llos/TARGET_CORTEX_M;$(LlilumSDK)lwip/lwip-eth/arch/TARGET_NXP
-mcpu=$(LlilumTargetBoardArchitectureLPC1768)
$(LlilumLwipIncludeDirs);$(LlilumTargetDirLPC1768);$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768);$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768);$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetBrandLPC1768);$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetBrandLPC1768)/$(LlilumTargetClassLPC1768);$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetBrandLPC1768)/$(LlilumTargetClassLPC1768)/$(LlilumTargetBoardMbedLPC1768);$(LlilumSDK)ARM_GCC\arm-none-eabi\include
TARGET_LPC1768;TARGET_M3;TARGET_CORTEX_M;TARGET_NXP;TARGET_LPC176X;TARGET_MBED_LPC1768;TOOLCHAIN_GCC_ARM;TOOLCHAIN_GCC;__CORTEX_M3;ARM_MATH_CM3;MBED_BUILD_TIMESTAMP=1435688844.64;__MBED__=1
$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)/board.o;$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)/cmsis_nvic.o;$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)/retarget.o;$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)/system_LPC17xx.o
$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)
-T"$(LlilumTargetDirLPC1768)$(LlilumTargetBoardLPC1768)/$(LlilumTargetToolchainLPC1768)/LPC1768.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x6A00
0xC00
$(LlilumTargetDirLPC1768)
$(LlilumTargetBoardLPC1768)
$(LlilumTargetBrandLPC1768)
$(LlilumTargetToolchainLPC1768)
$(LlilumTargetClassLPC1768)
$(LlilumTargetBoardMbedLPC1768)
$(LlilumTargetBoardArchitectureLPC1768)
$(LlilumLwipIncludeDirs)
$(LlilumClAdditionalOptionsLPC1768)
$(LlilumClAdditionalIncludesLPC1768)
$(LlilumClPreprocessorDefsLPC1768)
$(LlilumLinkAdditionalDepsLPC1768)
$(LlilumLinkAdditionalLibDirsLPC1768)
$(LlilumLinkAdditionalOptionsLPC1768)
$(LlilumLinkLibDepsLPC1768)
$(LlilumAsmAdditionalOptionsLPC1768)
$(LlilumStackSizeLPC1768)
$(LlilumHeapSizeLPC1768)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_STM32F091.props
================================================
$(LlilumSDK)mbed\
TARGET_NUCLEO_F401RE
TARGET_STM
TOOLCHAIN_GCC_ARM
TARGET_STM32F4
TARGET_NUCLEO_F401RE
cortex-m4
$(LlilumTargetDirLPC1768)EthernetInterface;$(LlilumSDK)lwip\lwip;$(LlilumSDK)lwip\lwip\include;$(LlilumSDK)lwip\lwip\include\ipv4;$(LlilumSDK)lwip\lwip\include\ipv4\lwip;$(LlilumSDK)lwip\lwip\include\lwip;$(LlilumSDK)lwip\lwip\include\netif;$(LlilumSDK)lwip\lwip\netif;$(LlilumSDK)lwip/lwip/netif/ppp;$(LlilumSDK)lwip/lwip/api;$(LlilumSDK)lwip/lwip/core;$(LlilumSDK)lwip/lwip/core/ipv4;$(LlilumSDK)lwip/lwip/core/snmp;$(LlilumSDK)lwip/lwip-eth;$(LlilumSDK)lwip/lwip-eth/arch;$(LlilumSDK)lwip/lwip-sys;$(LlilumSDK)lwip/lwip-sys/arch;$(LlilumSDK)mbed-rtos/llos;$(LlilumSDK)mbed-rtos/llos/TARGET_CORTEX_M;$(LlilumSDK)lwip/lwip-eth/arch/TARGET_NXP
stlink-v2-1.cfg
st_nucleo_f4.cfg
-mcpu=$(LlilumTargetBoardArchitectureSTM32F091) -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
$(LlilumLwipIncludeDirs);$(LlilumTargetDirSTM32F091);$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091);$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091);$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetBrandSTM32F091);$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetBrandSTM32F091)/$(LlilumTargetClassSTM32F091);$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetBrandSTM32F091)/$(LlilumTargetClassSTM32F091)/$(LlilumTargetBoardMbedSTM32F091);
TARGET_FF_ARDUINO;TOOLCHAIN_GCC_ARM;TARGET_NUCLEO_F401RE;__CORTEX_M4;TARGET_CORTEX_M;__FPU_PRESENT=1;__MBED__=1;TARGET_M4;TARGET_FF_MORPHO;TARGET_STM;TARGET_STM32F4;TOOLCHAIN_GCC;TARGET_STM32F091RE;ARM_MATH_CM4;MBED_BUILD_TIMESTAMP=1450373147.1
$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_flash_ramfunc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/board.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/cmsis_nvic.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/hal_tick.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/mbed_overrides.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/retarget.o ;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_adc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_adc_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_can.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_cec.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_cortex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_crc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_cryp.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_cryp_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dac.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dac_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dcmi.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dcmi_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dma.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dma2d.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dma_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_dsi.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_eth.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_flash.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_flash_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_fmpi2c_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_fmpi2c.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_msp_template.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_gpio.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_hash.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_hash_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_hcd.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_i2c.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_i2c_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_i2s.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_i2s_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_irda.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_iwdg.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_lptim.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_ltdc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_ltdc_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_smartcard.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_nand.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_nor.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_pccard.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_pcd.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_pcd_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_pwr.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_pwr_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_qspi.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_rcc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_rcc_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_rng.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_rtc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_rtc_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_sai.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_sai_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_sd.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_sdram.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_spdifrx.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_spi.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_sram.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_tim.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_tim_ex.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_uart.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_usart.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_hal_wwdg.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_ll_fmc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_ll_fsmc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_ll_sdmmc.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/stm32f4xx_ll_usb.o;$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/system_stm32f4xx.o
$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)
-T"$(LlilumTargetDirSTM32F091)$(LlilumTargetBoardSTM32F091)/$(LlilumTargetToolchainSTM32F091)/STM32F091XE.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x6000
$(LlilumTargetDirSTM32F091)
$(LlilumTargetBoardSTM32F091)
$(LlilumTargetBrandSTM32F091)
$(LlilumTargetToolchainSTM32F091)
$(LlilumTargetClassSTM32F091)
$(LlilumTargetBoardMbedSTM32F091)
$(LlilumTargetBoardArchitectureSTM32F091)
$(LlilumLwipIncludeDirs)
$(LlilumClAdditionalOptionsSTM32F091)
$(LlilumClAdditionalIncludesSTM32F091)
$(LlilumClPreprocessorDefsSTM32F091)
$(LlilumLinkAdditionalDepsSTM32F091)
$(LlilumLinkAdditionalLibDirsSTM32F091)
$(LlilumLinkAdditionalOptionsSTM32F091)
$(LlilumLinkLibDepsSTM32F091)
$(LlilumAsmAdditionalOptionsSTM32F091)
$(LlilumStackSizeSTM32F091)
$(LlilumHeapSizeSTM32F091)
$(LlilumOpenOcdInterfaceCfgSTM32F091)
$(LlilumOpenOcdBoardCfgSTM32F091)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_STM32F401.props
================================================
$(LlilumSDK)mbed\
TARGET_NUCLEO_F401RE
TARGET_STM
TOOLCHAIN_GCC_ARM
TARGET_STM32F4
TARGET_NUCLEO_F401RE
cortex-m4
$(LlilumTargetDirLPC1768)EthernetInterface;$(LlilumSDK)lwip\lwip;$(LlilumSDK)lwip\lwip\include;$(LlilumSDK)lwip\lwip\include\ipv4;$(LlilumSDK)lwip\lwip\include\ipv4\lwip;$(LlilumSDK)lwip\lwip\include\lwip;$(LlilumSDK)lwip\lwip\include\netif;$(LlilumSDK)lwip\lwip\netif;$(LlilumSDK)lwip/lwip/netif/ppp;$(LlilumSDK)lwip/lwip/api;$(LlilumSDK)lwip/lwip/core;$(LlilumSDK)lwip/lwip/core/ipv4;$(LlilumSDK)lwip/lwip/core/snmp;$(LlilumSDK)lwip/lwip-eth;$(LlilumSDK)lwip/lwip-eth/arch;$(LlilumSDK)lwip/lwip-sys;$(LlilumSDK)lwip/lwip-sys/arch;$(LlilumSDK)mbed-rtos/llos;$(LlilumSDK)mbed-rtos/llos/TARGET_CORTEX_M;$(LlilumSDK)lwip/lwip-eth/arch/TARGET_NXP
stlink-v2-1.cfg
st_nucleo_f4.cfg
-mcpu=$(LlilumTargetBoardArchitectureSTM32F401) -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
$(LlilumLwipIncludeDirs);$(LlilumTargetDirSTM32F401);$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401);$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401);$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetBrandSTM32F401);$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetBrandSTM32F401)/$(LlilumTargetClassSTM32F401);$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetBrandSTM32F401)/$(LlilumTargetClassSTM32F401)/$(LlilumTargetBoardMbedSTM32F401);
TARGET_FF_ARDUINO;TOOLCHAIN_GCC_ARM;TARGET_NUCLEO_F401RE;__CORTEX_M4;TARGET_CORTEX_M;__FPU_PRESENT=1;__MBED__=1;TARGET_M4;TARGET_FF_MORPHO;TARGET_STM;TARGET_STM32F4;TOOLCHAIN_GCC;TARGET_STM32F401RE;ARM_MATH_CM4;MBED_BUILD_TIMESTAMP=1450373147.1
$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_flash_ramfunc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/board.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/cmsis_nvic.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/hal_tick.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/mbed_overrides.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/retarget.o ;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_adc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_adc_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_can.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_cec.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_cortex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_crc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_cryp.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_cryp_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dac.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dac_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dcmi.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dcmi_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dma.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dma2d.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dma_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_dsi.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_eth.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_flash.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_flash_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_fmpi2c_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_fmpi2c.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_msp_template.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_gpio.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_hash.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_hash_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_hcd.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_i2c.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_i2c_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_i2s.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_i2s_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_irda.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_iwdg.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_lptim.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_ltdc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_ltdc_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_smartcard.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_nand.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_nor.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_pccard.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_pcd.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_pcd_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_pwr.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_pwr_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_qspi.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_rcc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_rcc_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_rng.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_rtc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_rtc_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_sai.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_sai_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_sd.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_sdram.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_spdifrx.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_spi.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_sram.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_tim.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_tim_ex.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_uart.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_usart.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_hal_wwdg.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_ll_fmc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_ll_fsmc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_ll_sdmmc.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/stm32f4xx_ll_usb.o;$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/system_stm32f4xx.o
$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)
-T"$(LlilumTargetDirSTM32F401)$(LlilumTargetBoardSTM32F401)/$(LlilumTargetToolchainSTM32F401)/STM32F401XE.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x6000
$(LlilumTargetDirSTM32F401)
$(LlilumTargetBoardSTM32F401)
$(LlilumTargetBrandSTM32F401)
$(LlilumTargetToolchainSTM32F401)
$(LlilumTargetClassSTM32F401)
$(LlilumTargetBoardMbedSTM32F401)
$(LlilumTargetBoardArchitectureSTM32F401)
$(LlilumLwipIncludeDirs)
$(LlilumClAdditionalOptionsSTM32F401)
$(LlilumClAdditionalIncludesSTM32F401)
$(LlilumClPreprocessorDefsSTM32F401)
$(LlilumLinkAdditionalDepsSTM32F401)
$(LlilumLinkAdditionalLibDirsSTM32F401)
$(LlilumLinkAdditionalOptionsSTM32F401)
$(LlilumLinkLibDepsSTM32F401)
$(LlilumAsmAdditionalOptionsSTM32F401)
$(LlilumStackSizeSTM32F401)
$(LlilumHeapSizeSTM32F401)
$(LlilumOpenOcdInterfaceCfgSTM32F401)
$(LlilumOpenOcdBoardCfgSTM32F401)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_STM32F411.props
================================================
$(LlilumSDK)mbed\
TARGET_NUCLEO_F411RE
TARGET_STM
TOOLCHAIN_GCC_ARM
TARGET_STM32F4
TARGET_NUCLEO_F411RE
cortex-m4
$(LlilumTargetDirLPC1768)EthernetInterface;$(LlilumSDK)lwip\lwip;$(LlilumSDK)lwip\lwip\include;$(LlilumSDK)lwip\lwip\include\ipv4;$(LlilumSDK)lwip\lwip\include\ipv4\lwip;$(LlilumSDK)lwip\lwip\include\lwip;$(LlilumSDK)lwip\lwip\include\netif;$(LlilumSDK)lwip\lwip\netif;$(LlilumSDK)lwip/lwip/netif/ppp;$(LlilumSDK)lwip/lwip/api;$(LlilumSDK)lwip/lwip/core;$(LlilumSDK)lwip/lwip/core/ipv4;$(LlilumSDK)lwip/lwip/core/snmp;$(LlilumSDK)lwip/lwip-eth;$(LlilumSDK)lwip/lwip-eth/arch;$(LlilumSDK)lwip/lwip-sys;$(LlilumSDK)lwip/lwip-sys/arch;$(LlilumSDK)mbed-rtos/llos;$(LlilumSDK)mbed-rtos/llos/TARGET_CORTEX_M;$(LlilumSDK)lwip/lwip-eth/arch/TARGET_NXP
stlink-v2-1.cfg
st_nucleo_f4.cfg
-mcpu=$(LlilumTargetBoardArchitectureSTM32F411) -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
$(LlilumLwipIncludeDirs);$(LlilumTargetDirSTM32F411);$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411);$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411);$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetBrandSTM32F411);$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetBrandSTM32F411)/$(LlilumTargetClassSTM32F411);$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetBrandSTM32F411)/$(LlilumTargetClassSTM32F411)/$(LlilumTargetBoardMbedSTM32F411);
TARGET_FF_ARDUINO;TOOLCHAIN_GCC_ARM;TARGET_NUCLEO_F411RE;__CORTEX_M4;TARGET_CORTEX_M;__FPU_PRESENT=1;__MBED__=1;TARGET_M4;TARGET_FF_MORPHO;TARGET_STM;TARGET_STM32F4;TOOLCHAIN_GCC;TARGET_STM32F411RE;ARM_MATH_CM4;MBED_BUILD_TIMESTAMP=1450373147.1
$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_flash_ramfunc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/board.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/cmsis_nvic.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/hal_tick.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/mbed_overrides.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/retarget.o ;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_adc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_adc_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_can.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_cec.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_cortex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_crc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_cryp.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_cryp_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dac.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dac_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dcmi.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dcmi_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dma.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dma2d.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dma_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_dsi.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_eth.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_flash.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_flash_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_fmpi2c_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_fmpi2c.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_msp_template.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_gpio.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_hash.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_hash_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_hcd.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_i2c.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_i2c_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_i2s.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_i2s_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_irda.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_iwdg.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_lptim.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_ltdc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_ltdc_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_smartcard.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_nand.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_nor.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_pccard.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_pcd.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_pcd_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_pwr.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_pwr_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_qspi.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_rcc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_rcc_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_rng.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_rtc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_rtc_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_sai.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_sai_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_sd.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_sdram.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_spdifrx.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_spi.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_sram.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_tim.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_tim_ex.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_uart.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_usart.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_hal_wwdg.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_ll_fmc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_ll_fsmc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_ll_sdmmc.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/stm32f4xx_ll_usb.o;$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/system_stm32f4xx.o
$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)
-T"$(LlilumTargetDirSTM32F411)$(LlilumTargetBoardSTM32F411)/$(LlilumTargetToolchainSTM32F411)/STM32F411XE.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x6000
$(LlilumTargetDirSTM32F411)
$(LlilumTargetBoardSTM32F411)
$(LlilumTargetBrandSTM32F411)
$(LlilumTargetToolchainSTM32F411)
$(LlilumTargetClassSTM32F411)
$(LlilumTargetBoardMbedSTM32F411)
$(LlilumTargetBoardArchitectureSTM32F411)
$(LlilumLwipIncludeDirs)
$(LlilumClAdditionalOptionsSTM32F411)
$(LlilumClAdditionalIncludesSTM32F411)
$(LlilumClPreprocessorDefsSTM32F411)
$(LlilumLinkAdditionalDepsSTM32F411)
$(LlilumLinkAdditionalLibDirsSTM32F411)
$(LlilumLinkAdditionalOptionsSTM32F411)
$(LlilumLinkLibDepsSTM32F411)
$(LlilumAsmAdditionalOptionsSTM32F411)
$(LlilumStackSizeSTM32F411)
$(LlilumHeapSizeSTM32F411)
$(LlilumOpenOcdInterfaceCfgSTM32F411)
$(LlilumOpenOcdBoardCfgSTM32F411)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/Llilum_STM32L152.props
================================================
$(LlilumSDK)mbed\
TARGET_NUCLEO_L152RE
TARGET_STM
TOOLCHAIN_GCC_ARM
TARGET_STM32L1
TARGET_NUCLEO_L152RE
cortex-m3
stlink-v2-1.cfg
st_nucleo_l1.cfg
-mcpu=$(LlilumTargetBoardArchitectureSTM32L152) -mthumb
$(LlilumTargetDirSTM32L152);$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152);$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152);$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetBrandSTM32L152);$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetBrandSTM32L152)/$(LlilumTargetClassSTM32L152);$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetBrandSTM32L152)/$(LlilumTargetClassSTM32L152)/$(LlilumTargetBoardMbedSTM32L152);
MBED_BUILD_TIMESTAMP=1445629897.99;TARGET_FF_ARDUINO;TOOLCHAIN_GCC_ARM;TOOLCHAIN_GCC;TARGET_FF_MORPHO;TARGET_CORTEX_M;ARM_MATH_CM3;TARGET_STM32L1;TARGET_STM;__CORTEX_M3;TARGET_NUCLEO_L152RE;TARGET_M3;TARGET_STM32L152RE;__MBED__=1
$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_flash_ramfunc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/board.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/cmsis_nvic.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/hal_tick.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/mbed_overrides.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/retarget.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_adc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_adc_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_comp.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_cortex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_crc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_cryp.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_cryp_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_dac.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_dac_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_dma.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_flash.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_flash_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_smartcard.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_gpio.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_i2c.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_i2s.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_irda.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_iwdg.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_lcd.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_nor.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_opamp.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_opamp_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_pcd.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_pcd_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_pwr.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_pwr_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_rcc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_rcc_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_rtc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_rtc_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_sd.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_spi.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_spi_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_sram.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_tim.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_tim_ex.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_uart.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_usart.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_hal_wwdg.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_ll_fsmc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/stm32l1xx_ll_sdmmc.o;$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/system_stm32l1xx.o
$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)
-T"$(LlilumTargetDirSTM32L152)$(LlilumTargetBoardSTM32L152)/$(LlilumTargetToolchainSTM32L152)/STM32L152XE.ld" -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main
mbed;stdc++;supc++;m;c;gcc;nosys
0x800
0x4000
$(LlilumTargetDirSTM32L152)
$(LlilumTargetBoardSTM32L152)
$(LlilumTargetBrandSTM32L152)
$(LlilumTargetToolchainSTM32L152)
$(LlilumTargetClassSTM32L152)
$(LlilumTargetBoardMbedSTM32L152)
$(LlilumTargetBoardArchitectureSTM32L152)
$(LlilumClAdditionalOptionsSTM32L152)
$(LlilumClAdditionalIncludesSTM32L152)
$(LlilumClPreprocessorDefsSTM32L152)
$(LlilumLinkAdditionalDepsSTM32L152)
$(LlilumLinkAdditionalLibDirsSTM32L152)
$(LlilumLinkAdditionalOptionsSTM32L152)
$(LlilumLinkLibDepsSTM32L152)
$(LlilumAsmAdditionalOptionsSTM32L152)
$(LlilumStackSizeSTM32L152)
$(LlilumHeapSizeSTM32L152)
$(LlilumOpenOcdInterfaceCfgSTM32L152)
$(LlilumOpenOcdBoardCfgSTM32L152)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/1.0/Platforms/mbed-rtos.props
================================================
$(LlilumSDK)\mbed-rtos\rtx\TARGET_CORTEX_M;%(AdditionalIncludeDirectories)
================================================
FILE: VisualStudio/LlilumApplicationType/Llilum/Default.props
================================================
Android
ARM
4.9 2015q1
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\ARM\GNU Tools for ARM Embedded Processors', 'InstallFolder', null, RegistryView.Registry64, RegistryView.Registry32))
$(MSBuildProgramFiles32)\GNU Tools ARM Embedded\$(LLilumGccVersion)\
$(LLILUM_GCC)\
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Llilum\v1.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))
$(LLILUM_SDK)\
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumApplication.ProjectTemplate.csproj
================================================
14.0
12.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
SAK
SAK
SAK
SAK
4.0
publish\
true
Disk
false
Foreground
7
Days
false
false
true
0
1.0.0.%2a
false
false
true
Debug
AnyCPU
2.0
{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
{5747D247-5FCC-4151-942C-811603768ABE}
Library
Properties
LlilumApplication
LlilumApplication
v4.5
false
false
false
false
false
false
false
false
false
false
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
pdbonly
true
bin\Release\
TRACE
prompt
4
Designer
False
Microsoft .NET Framework 4.5 %28x86 and x64%29
true
False
.NET Framework 3.5 SP1
false
Designer
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumApplication.vstemplate
================================================
Llilum Application Project
A template for creating a Llilum Application project.
LlilumApplication.ico
LlilumApplication
4.5.2
1
{95af4530-3c8f-4126-a438-e2c18a6133f5}
true
LlilumApplication
true
LlilumNative\MyTemplate.vstemplate
LlilumManaged\MyTemplate.vstemplate
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumManaged/Managed.csproj
================================================
Debug
AnyCPU
{$guid1$}
Exe
Properties
$safeprojectname$
Llilum.Managed
v4.5
512
Llilum
1.0
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
true
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumManaged/MyTemplate.vstemplate
================================================
LlilumManaged
Managed code for a Llilum embedded project
CSharp
1000
true
LlilumManaged
true
Enabled
true
__TemplateIcon.ico
__PreviewImage.ico
Program.cs
AssemblyInfo.cs
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumManaged/Program.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#define LPC1768
//#define K64F
//#define STM32F411
//#define STM32F401
//#define STM32F091
namespace Managed
{
using System;
using Windows.Devices.Gpio;
using System.Runtime.InteropServices;
using System.Threading;
#if LPC1768
using Microsoft.Llilum.LPC1768;
#elif K64F
using Microsoft.Llilum.K64F;
#elif STM32F411
using Microsoft.Llilum.STM32F411;
#elif STM32F401
using Microsoft.Llilum.STM32F401;
#elif STM32F091
using Microsoft.Llilum.STM32F091;
#endif
class Program
{
// Example of C interop functions
[DllImport("C")]
private static extern int AddOneInterop(int input);
const float period = 0.75f;
const float timePerMode = 4.0f;
static int[] pinNumbers =
{
#if (LPC1768)
(int)PinName.LED1,
(int)PinName.LED4,
#elif (K64F)
(int)PinName.LED_BLUE,
(int)PinName.LED_RED,
#elif (STM32F411 || STM32F401 || STM32F091)
(int)PinName.LED1,
(int)PinName.LED1,
#else
#error No target board defined.
#endif
};
static void Main()
{
var controller = GpioController.GetDefault();
var threadToggledPin = controller.OpenPin(pinNumbers[0]);
#if (STM32F411 || STM32F401 || STM32F091)
var loopToggledPin = threadToggledPin;
#else
var loopToggledPin = controller.OpenPin(pinNumbers[1]);
#endif
threadToggledPin.SetDriveMode(GpioPinDriveMode.Output);
loopToggledPin.SetDriveMode(GpioPinDriveMode.Output);
int threadPinState = 1;
int loopPinState = 1;
// Toggling a pin with a thread
var ev = new AutoResetEvent(false);
var solitaryBlinker = new Thread(delegate ()
{
while (true)
{
ev.WaitOne(1000, false);
threadToggledPin.Write((GpioPinValue)threadPinState);
// Using the C interop here
threadPinState = AddOneInterop(threadPinState) % 2;
}
});
solitaryBlinker.Start();
// Toggling a pin in a loop
long last = DateTime.Now.Ticks;
while (true)
{
long now = DateTime.Now.Ticks;
// Toggle every 500ms
if (now > (last + 5000000))
{
last = now;
// Toggle the pin
loopToggledPin.Write((GpioPinValue)loopPinState);
// Using the C interop here
loopPinState = AddOneInterop(loopPinState) % 2;
}
}
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumManaged/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("$safeprojectname$")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("$safeprojectname$")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("$guid3$")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/MyTemplate.vstemplate
================================================
LlilumNative
Native code for a Llilum embedded project
VC
1000
true
LlilumNative
true
Enabled
true
__TemplateIcon.ico
__PreviewImage.ico
pch.h
Source.cpp
mbed_simple_K64F.FrontEndConfig
mbed_simple_LPC1768.FrontEndConfig
mbed_simple_STM32L152.FrontEndConfig
mbed_simple_STM32F411.FrontEndConfig
mbed_simple_STM32F401.FrontEndConfig
mbed_simple_STM32F091.FrontEndConfig
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/Native.vcxproj
================================================
Debug
ARM
Release
ARM
{$guid2$}
Android
$safeprojectname$
14.0
Llilum
1.0
$(LLILUM_GCC)
Native
LPC1768
$(MSBuildProjectDirectory)\mbed_simple_$(LlilumBoardName).FrontEndConfig
$(LlilumSDK)os_layer\ports\mbed\inc;$(LlilumSDK)os_layer\inc;$(LlilumSDK)os_layer\inc\api;$(LlilumSDK)os_layer\inc\api\io;$(LlilumSDK)os_layer\inc\hal
$(LlilumClAdditionalOptionsLPC1768)
$(LlilumClAdditionalIncludesLPC1768)
$(LlilumClPreprocessorDefsLPC1768)
$(LlilumLinkAdditionalDepsLPC1768)
$(LlilumLinkAdditionalLibDirsLPC1768)
$(LlilumLinkAdditionalOptionsLPC1768)
$(LlilumLinkLibDepsLPC1768)
$(LlilumTargetBoardArchitectureLPC1768)
$(LlilumAsmAdditionalOptionsLPC1768)
$(LlilumStackSizeLPC1768)
$(LlilumHeapSizeLPC1768)
$(LlilumClAdditionalOptionsK64F)
$(LlilumClAdditionalIncludesK64F)
$(LlilumClPreprocessorDefsK64F)
$(LlilumLinkAdditionalDepsK64F)
$(LlilumLinkAdditionalLibDirsK64F)
$(LlilumLinkAdditionalOptionsK64F)
$(LlilumLinkLibDepsK64F)
$(LlilumTargetBoardArchitectureK64F)
$(LlilumAsmAdditionalOptionsK64F)
$(LlilumStackSizeK64F)
$(LlilumHeapSizeK64F)
$(LlilumClAdditionalOptionsSTM32F091)
$(LlilumClAdditionalIncludesSTM32F091)
$(LlilumClPreprocessorDefsSTM32F091)
$(LlilumLinkAdditionalDepsSTM32F091)
$(LlilumLinkAdditionalLibDirsSTM32F091)
$(LlilumLinkAdditionalOptionsSTM32F091)
$(LlilumLinkLibDepsSTM32F091)
$(LlilumTargetBoardArchitectureSTM32F091)
$(LlilumAsmAdditionalOptionsSTM32F091)
$(LlilumStackSizeSTM32F091)
$(LlilumHeapSizeSTM32F091)
$(LlilumOpenOcdInterfaceCfgSTM32F091)
$(LlilumOpenOcdBoardCfgSTM32F091)
$(LlilumClAdditionalOptionsSTM32L152)
$(LlilumClAdditionalIncludesSTM32L152)
$(LlilumClPreprocessorDefsSTM32L152)
$(LlilumLinkAdditionalDepsSTM32L152)
$(LlilumLinkAdditionalLibDirsSTM32L152)
$(LlilumLinkAdditionalOptionsSTM32L152)
$(LlilumLinkLibDepsSTM32L152)
$(LlilumTargetBoardArchitectureSTM32L152)
$(LlilumAsmAdditionalOptionsSTM32L152)
$(LlilumStackSizeSTM32L152)
$(LlilumHeapSizeSTM32L152)
$(LlilumOpenOcdInterfaceCfgSTM32L152)
$(LlilumOpenOcdBoardCfgSTM32L152)
$(LlilumClAdditionalOptionsSTM32F411)
$(LlilumClAdditionalIncludesSTM32F411)
$(LlilumClPreprocessorDefsSTM32F411)
$(LlilumLinkAdditionalDepsSTM32F411)
$(LlilumLinkAdditionalLibDirsSTM32F411)
$(LlilumLinkAdditionalOptionsSTM32F411)
$(LlilumLinkLibDepsSTM32F411)
$(LlilumTargetBoardArchitectureSTM32F411)
$(LlilumAsmAdditionalOptionsSTM32F411)
$(LlilumStackSizeSTM32F411)
$(LlilumHeapSizeSTM32F411)
$(LlilumOpenOcdInterfaceCfgSTM32F411)
$(LlilumOpenOcdBoardCfgSTM32F411)
$(LlilumClAdditionalOptionsSTM32F401)
$(LlilumClAdditionalIncludesSTM32F401)
$(LlilumClPreprocessorDefsSTM32F401)
$(LlilumLinkAdditionalDepsSTM32F401)
$(LlilumLinkAdditionalLibDirsSTM32F401)
$(LlilumLinkAdditionalOptionsSTM32F401)
$(LlilumLinkLibDepsSTM32F401)
$(LlilumTargetBoardArchitectureSTM32F401)
$(LlilumAsmAdditionalOptionsSTM32F401)
$(LlilumStackSizeSTM32F401)
$(LlilumHeapSizeSTM32F401)
$(LlilumOpenOcdInterfaceCfgSTM32F401)
$(LlilumOpenOcdBoardCfgSTM32F401)
DynamicLibrary
true
$(LlilumTargetBoardArchitecture)
DynamicLibrary
$(LlilumTargetBoardArchitecture)
system
false
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
$(LlilumOutputName)
.elf
$(LlilumGccBin);$(ExecutablePath)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);DEBUG;%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
Use
pch.h
$(LlilumClAdditionalOptions) %(AdditionalOptions)
$(LlilumClAdditionalIncludes);%(AdditionalIncludeDirectories);$(NativeIncludes)
$(LlilumClPreprocessorDefs);%(PreprocessorDefinitions);__DEFAULT_STACK_SIZE=$(LlilumStackSize);__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumAsmAdditionalOptions) %(LlilumClAdditionalOptions) -Wa,--defsym,__HEAP_SIZE=$(LlilumHeapSize)
$(LlilumLinkAdditionalDeps)
$(LlilumLinkAdditionalLibDirs)
$(LlilumLinkAdditionalOptions) %(AdditionalOptions)
$(LlilumLinkLibDeps)
{$guid1$}
true
true
true
true
true
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/Source.cpp
================================================
extern "C"
{
// User's C interop code goes here
// Dummy function used in Program.cs as an example
int AddOneInterop(int input)
{
return input + 1;
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_K64F.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.K64F.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference K64F
-Reference Microsoft.Zelig.LlilumCMSIS-RTOS
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath c:\src\llvm\llvm-3.7.0.src\build\x64\Release\bin\
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_LPC1768.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m3
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.LPC1768.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.LPC1768MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference LPC1768
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
-CompilationOption System.String GarbageCollectionManager ConservativeMarkAndSweepCollector
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_STM32F091.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m0
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F091.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F091MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM0OnMBED
-Reference Microsoft.CortexM0OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM0
-Reference STM32F091
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath c:\src\llvm\llvm-3.7.0.src\build\x64\Release\bin
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_STM32F401.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F401.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F401MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference STM32F401
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_STM32F411.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F411.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F411MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference STM32F411
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/mbed_simple_STM32L152.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m3
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32L152.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32L152MBEDHostedCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference STM32L152
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase All
-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/LlilumNative/pch.h
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectTemplate/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/DeployedBuildSystem/CustomProject.Default.props
================================================
$(MSBuildThisFileDirectory)
Debug
x86
7.0
v4.6
Client
.NETFramework,Version=$(TargetFrameworkVersion)
exe
bin\$(Configuration)\
true
LlilumDebugger
TAB_SDK_ALL
TAB_ASSEMBLY_ALL
$(MSBuildProjectName)
$(Name)
$(Name)
false
true
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/DeployedBuildSystem/CustomProject.props
================================================
$(LLILUM_SDK)
$(LlilumSDK)LLVM\Debug\bin\
$(LlilumSDK)mbed\
LPC1768
TARGET_LPC1768
TARGET_NXP
TOOLCHAIN_GCC_ARM
TARGET_LPC176X
TARGET_MBED_LPC1768
$(SolutionName)
$(LlilumSDK)ARM_GCC\4.9\bin
$(OutDir)\$(LlilumOutputName).bin
$(LlilumSDK)\bin\Microsoft.Zelig.Compiler.exe
$(MSBuildProjectDirectory)\mbed_simple_$(LlilumBoardName).FrontEndConfig
$(LlilumSDK)
$(LlilumLLVM)
$(LlilumCompiler)
$(LlilumConfig)
$(LlilumTargetDir)
$(LlilumTargetBoard)
$(LlilumTargetBrand)
$(LlilumTargetToolchain)
$(LlilumTargetClass)
$(LlilumTargetBoardMbed)
$(LlilumOutputName)
$(LlilumGccBin)
$(LlilumOutputBin)
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/DeployedBuildSystem/CustomProject.targets
================================================
Debug
AnyCPU
Release
AnyCPU
Project
Project
File
Invisible
File;BrowseObject
;BrowseObject
ProjectSubscriptionService;BrowseObject
BrowseObject
Project
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/DeployedBuildSystem/CustomProjectCs.targets
================================================
File
BrowseObject
Project
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/Rules/CustomPropertyPage.xaml
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/Rules/LlilumDebugger.xaml
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/Rules/ProjectItemsSchema.xaml
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/BuildSystem/Rules/debugger_general.xaml
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/LlilumApplication.ProjectType.csproj
================================================
14.0
14.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
Debug
AnyCPU
8.0.30703
2.0
{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
{74611D01-A97F-438C-B687-448FEEDBE4FB}
Library
Properties
LlilumApplication
LlilumApplication
v4.5.2
512
true
Key.snk
Program
$(MSBuildProgramFiles32)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
/rootSuffix Exp
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
x86
pdbonly
true
bin\Release\
TRACE
prompt
4
True
True
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\MDD\Debugger\Microsoft.MIDebugEngine.dll
..\..\packages\Microsoft.VisualStudio.Composition.14.0.50715-pre\lib\net451\Microsoft.VisualStudio.Composition.dll
True
..\..\packages\Microsoft.VisualStudio.Composition.14.0.50715-pre\lib\net451\Microsoft.VisualStudio.Composition.Configuration.dll
True
..\..\packages\Microsoft.VisualStudio.ProjectSystem.14.0.50721-pre\lib\net451\Microsoft.VisualStudio.ProjectSystem.Interop.dll
True
..\..\packages\Microsoft.VisualStudio.ProjectSystem.14.0.50721-pre\lib\net451\Microsoft.VisualStudio.ProjectSystem.Utilities.v14.0.dll
True
..\..\packages\Microsoft.VisualStudio.ProjectSystem.14.0.50721-pre\lib\net451\Microsoft.VisualStudio.ProjectSystem.V14Only.dll
True
..\..\packages\Microsoft.VisualStudio.ProjectSystem.14.0.50721-pre\lib\net451\Microsoft.VisualStudio.ProjectSystem.VS.V14Only.dll
True
True
True
True
True
True
True
..\..\packages\Microsoft.VisualStudio.Threading.14.0.50702\lib\net45\Microsoft.VisualStudio.Threading.dll
True
..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
True
..\..\packages\Microsoft.Tpl.Dataflow.4.5.24\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll
True
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}
Microsoft.MIEngine.CoreRegisters.ARM
BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3bPkgdefProjectOutputGroup%3b
DebugSymbolsProjectOutputGroup%3b
false
{5747d247-5fcc-4151-942c-811603768abe}
LlilumApplication.ProjectTemplate
false
TemplateProjectOutputGroup%3b
ProjectTemplates
Designer
None
Designer
Designer
MSBuild:Compile
MSBuild:Compile
Designer
Always
true
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/LlilumDebuggerLaunchProvider.cs
================================================
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Debuggers;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
using Microsoft.VisualStudio.ProjectSystem.Utilities.DebuggerProviders;
using Microsoft.VisualStudio.ProjectSystem.VS.Debuggers;
using System.Diagnostics;
using System.IO;
namespace LlilumApplication
{
[ExportDebugger(LlilumDebugger.SchemaName)]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
public class LlilumDebuggerLaunchProvider : DebugLaunchProviderBase
{
private static readonly string DebuggerOptionsFormat = @"";
private static readonly string DebuggerFileFormat = @"{0}\{1}.bat";
private static readonly string DebuggerScriptContentFormat = @"""{0}"" ""{1}"" {2} %*";
private static readonly string DebuggerLoadScriptContentFormat = @"""{0}"" ""{1}"" -ex ""load ""{1}"""" {2} %*";
// TODO: Specify the assembly full name here
[ExportPropertyXamlRuleDefinition("LlilumApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9be6e469bc4921f1", "XamlRuleToCode:LlilumDebugger.xaml", "Project")]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
private object DebuggerXaml { get { throw new NotImplementedException(); } }
[ImportingConstructor]
public LlilumDebuggerLaunchProvider(ConfiguredProject configuredProject)
: base(configuredProject)
{
}
///
/// Gets project properties that the debugger needs to launch.
///
[Import]
private ProjectProperties DebuggerProperties { get; set; }
public override async Task CanLaunchAsync(DebugLaunchOptions launchOptions)
{
var properties = await this.DebuggerProperties.GetLlilumDebuggerPropertiesAsync();
string commandValue = await properties.LlilumDebuggerCommand.GetEvaluatedValueAtEndAsync();
return !string.IsNullOrEmpty(commandValue);
}
public string CreateDebuggerFileIfNoneExist(string workingDirectory, string executablePath, string gdbPath, string gdbArgs, string script)
{
string debuggerFile = string.Format(DebuggerFileFormat, workingDirectory, "tmp_debug");
if(!File.Exists(debuggerFile))
{
using (System.IO.StreamWriter file =
new System.IO.StreamWriter(debuggerFile))
{
file.WriteLine(string.Format(script, gdbPath, executablePath, gdbArgs));
}
}
return debuggerFile;
}
public override async Task> QueryDebugTargetsAsync(DebugLaunchOptions launchOptions)
{
var settings = new DebugLaunchSettings(launchOptions);
// The properties that are available via DebuggerProperties are determined by the property XAML files in your project.
var debuggerProperties = await this.DebuggerProperties.GetLlilumDebuggerPropertiesAsync();
string dir = await debuggerProperties.LlilumDebuggerWorkingDirectory.GetEvaluatedValueAtEndAsync();
string executable = await debuggerProperties.LlilumDebuggerCommand.GetEvaluatedValueAtEndAsync();
string gdbPath = await debuggerProperties.LlilumGdbPath.GetEvaluatedValueAtEndAsync();
string gdbArgs = await debuggerProperties.LlilumGdbArgs.GetEvaluatedValueAtEndAsync();
var gdbServer = await debuggerProperties.LlilumGdbServerOption.GetEvaluatedValueAtEndAsync();
settings.CurrentDirectory = dir;
settings.Executable = executable;
// If we are going to deploy with GDB load command, create a script that will also load the elf file
string debugScript = DebuggerScriptContentFormat;
var deployTool = await debuggerProperties.LlilumDeployTool.GetEvaluatedValueAtEndAsync();
if (string.Compare(deployTool, "gdbloadcommand", true) == 0)
{
debugScript = DebuggerLoadScriptContentFormat;
}
// Create the temporary file for passing to the debug engine
string debuggerFile = CreateDebuggerFileIfNoneExist(dir, executable, gdbPath, gdbArgs, debugScript);
settings.Options = string.Format(DebuggerOptionsFormat, debuggerFile);
settings.LaunchOperation = DebugLaunchOperation.CreateProcess;
settings.LaunchDebugEngineGuid = new Guid(Microsoft.MIDebugEngine.EngineConstants.EngineId);
// Launch py_ocd to communicate with GDB
string gdbServerPath = string.Empty;
string gdbServerArgs = string.Empty;
if(gdbServer.Equals("pyocd"))
{
gdbServerPath = await debuggerProperties.LlilumPyOcdPath.GetEvaluatedValueAtEndAsync();
gdbServerArgs = await debuggerProperties.LlilumPyOcdArgs.GetEvaluatedValueAtEndAsync();
}
else if (gdbServer.Equals("openocd"))
{
gdbServerPath = await debuggerProperties.LlilumOpenOcdPath.GetEvaluatedValueAtEndAsync();
gdbServerArgs = await debuggerProperties.LlilumOpenOcdArgs.GetEvaluatedValueAtEndAsync();
}
if (!string.IsNullOrWhiteSpace(gdbServerPath))
{
// Even though we did it in deploy, do it here just in case we go straight to debug
await LlilumHelpers.TryKillPyocdAsync();
await LlilumHelpers.TryKillOpenOcdAsync();
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = gdbServerPath;
start.Arguments = gdbServerArgs;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
Process gdbServerProcess = Process.Start(start);
}
return new IDebugLaunchSettings[] { settings };
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/LlilumDeployProvider.cs
================================================
using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Build;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
namespace LlilumApplication
{
[Export(typeof(IDeployProvider))]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
internal class LlilumDeployProvider : IDeployProvider
{
///
/// Provides access to the project's properties.
///
[Import]
private ProjectProperties Properties { get; set; }
[Import]
private IThreadHandling ThreadHandling { get; set; }
private async Task RunDeployTool(CancellationToken cancellationToken, TextWriter outputPaneWriter, string deployToolPath, string deployToolArgs)
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = deployToolPath;
start.Arguments = deployToolArgs;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
start.CreateNoWindow = true;
using (Process process = Process.Start(start))
using (StreamReader stdOut = process.StandardOutput)
using (StreamReader stdErr = process.StandardError)
{
try
{
var stdoutTask = Task.Run(() => SendProcessOutputToPaneAsync(outputPaneWriter, stdOut, cancellationToken));
var stderrTask = Task.Run(() => SendProcessOutputToPaneAsync(outputPaneWriter, stdErr, cancellationToken));
await Task.WhenAll(stdoutTask, stderrTask);
if (process.ExitCode != 0)
throw new ApplicationException($"Flash tool failed with exit code {process.ExitCode}");
}
catch (OperationCanceledException)
{
if (!process.HasExited)
{
process.CloseMainWindow();
}
}
}
}
public async Task DeployAsync( CancellationToken cancellationToken, TextWriter outputPaneWriter )
{
// Kill all instances of PyOcd and OpenOcd because they affect the flash-tool and debugger
await LlilumHelpers.TryKillPyocdAsync();
await LlilumHelpers.TryKillOpenOcdAsync();
var properties = await Properties.GetLlilumDebuggerPropertiesAsync();
var deployTool = await properties.LlilumDeployTool.GetEvaluatedValueAtEndAsync();
string deployToolPath = string.Empty;
string binaryPath = string.Empty;
if (string.Compare(deployTool, "pyocdflashtool", StringComparison.OrdinalIgnoreCase) == 0)
{
// Deploy with pyOCD Flash Tool
deployToolPath = await properties.LlilumFlashToolPath.GetEvaluatedValueAtEndAsync();
deployToolPath = Path.GetFullPath(deployToolPath.Trim('"'));
if (!File.Exists(deployToolPath))
{
var msg = $"Flash programming tool not found: '{deployToolPath}'";
outputPaneWriter.Write(msg);
throw new FileNotFoundException(msg);
}
}
else if (string.Compare(deployTool, "stlinkutility", StringComparison.OrdinalIgnoreCase) == 0)
{
// Deploy with ST-Link Utility
deployToolPath = await properties.LlilumSTLinkUtilityPath.GetEvaluatedValueAtEndAsync();
deployToolPath = Path.GetFullPath(deployToolPath.Trim('"'));
if (!File.Exists(deployToolPath))
{
var msg = $"STLink Utility not found: '{deployToolPath}'";
outputPaneWriter.Write(msg);
throw new FileNotFoundException(msg);
}
}
else if(string.Compare(deployTool, "copytodrive", StringComparison.OrdinalIgnoreCase) == 0)
{
// Deploy by copying to the drive. Do nothing
}
else
{
// Deploy with GDB command, or Do Not Deploy
return;
}
binaryPath = await properties.LlilumOutputBin.GetEvaluatedValueAtEndAsync( );
binaryPath = Path.GetFullPath( binaryPath.Trim( '"' ) );
if( !File.Exists( binaryPath ) )
{
var msg = $"Flash binary file not found: '{binaryPath}'";
outputPaneWriter.Write( msg );
throw new FileNotFoundException( msg );
}
if (string.Compare(deployTool, "pyocdflashtool", StringComparison.OrdinalIgnoreCase) == 0)
{
// Deploy with pyOCD Flash Tool
string flashToolArgs = await properties.LlilumFlashToolArgs.GetEvaluatedValueAtEndAsync();
flashToolArgs = $"{EnsureQuotedPathIfNeeded(binaryPath)} {flashToolArgs}";
await RunDeployTool(cancellationToken, outputPaneWriter, deployToolPath, flashToolArgs);
}
else if (string.Compare(deployTool, "stlinkutility", StringComparison.OrdinalIgnoreCase) == 0)
{
// Deploy with ST-Link Utility
string stlinkConnectArgs = await properties.LlilumSTLinkUtilityConnectArgs.GetEvaluatedValueAtEndAsync();
string stlinkEraseArgs = await properties.LlilumSTLinkUtilityEraseArgs.GetEvaluatedValueAtEndAsync();
string stlinkProgramArgs = await properties.LlilumSTLinkUtilityProgramArgs.GetEvaluatedValueAtEndAsync();
string stlinkDeployArgs = stlinkConnectArgs + " " + stlinkEraseArgs + " " + stlinkProgramArgs;
await RunDeployTool(cancellationToken, outputPaneWriter, deployToolPath, stlinkDeployArgs);
}
else if (string.Compare(deployTool, "copytodrive", StringComparison.OrdinalIgnoreCase) == 0)
{
// Copy to the specified drive
string drive = await properties.LlilumDriveToCopyTo.GetEvaluatedValueAtEndAsync();
drive = drive.Trim();
if(string.IsNullOrWhiteSpace(drive))
{
throw new ArgumentNullException("Drive not specified");
}
// Get the properly formatted string for the drive letter
DriveInfo driveInfo = new DriveInfo(drive);
drive = driveInfo.RootDirectory.FullName;
if (!Directory.Exists(drive))
{
throw new DriveNotFoundException("The drive specified could not be located");
}
string[] binaryPathArr = binaryPath.Split('\\');
string binaryName = binaryPathArr[binaryPathArr.Length - 1];
string destFile = System.IO.Path.Combine(drive, binaryName);
// Allow the copy to fail, and throw an exception on its own
File.Copy(binaryPath, destFile, true);
}
}
// Crude but effective ensurance of quoted string when a path contains spaces
// only runs once on deploy so not particularly perf critical
private static string EnsureQuotedPathIfNeeded( string path )
{
if( string.IsNullOrEmpty( path ) )
return path;
if( path[ 0 ] == '"' && path[ path.Length - 1 ] == '"' )
return path;
if( !path.Contains( " " ) )
return path;
return $"\"{path}\"";
}
private async Task SendProcessOutputToPaneAsync( TextWriter outputPaneWriter, StreamReader strm, CancellationToken cancellationToken )
{
while( !strm.EndOfStream && !cancellationToken.IsCancellationRequested )
{
outputPaneWriter.Write( await strm.ReadLineAsync( ) );
}
}
public bool IsDeploySupported
{
get { return true; }
}
public void Commit()
{
}
public void Rollback()
{
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/LlilumHelpers.cs
================================================
namespace LlilumApplication
{
using System.Diagnostics;
using System.Threading.Tasks;
public static class LlilumHelpers
{
public static Task TryKillPyocdAsync()
{
return Task.Run( ( ) =>
{
foreach( var proc in Process.GetProcessesByName( "pyocd_win" ) )
{
proc.Kill( );
proc.WaitForExit( );
}
} );
}
public static Task TryKillOpenOcdAsync()
{
return Task.Run(() =>
{
foreach (var proc in Process.GetProcessesByName("openocd"))
{
proc.Kill();
proc.WaitForExit();
}
});
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/MITLicense.txt
================================================
The MIT License (MIT)
Copyright (c) 2015 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/MyConfiguredProject.cs
================================================
/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
namespace LlilumApplication
{
using System;
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Designers;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Task = System.Threading.Tasks.Task;
[Export]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
internal class MyConfiguredProject
{
[Import, SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "MEF")]
internal ConfiguredProject ConfiguredProject { get; private set; }
[Import, SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "MEF")]
internal ProjectProperties Properties { get; private set; }
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/MyUnconfiguredProject.cs
================================================
/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
namespace LlilumApplication
{
using System;
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Designers;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Task = System.Threading.Tasks.Task;
[Export]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
[ProjectTypeRegistration(VsPackage.ProjectTypeGuid, "Llilum Application", "#2", ProjectExtension, Language, resourcePackageGuid: VsPackage.PackageGuid, PossibleProjectExtensions = ProjectExtension, ProjectTemplatesDir = @"..\..\Templates\Projects\MyCustomProject")]
[ProvideProjectItem(VsPackage.ProjectTypeGuid, "My Items", @"..\..\Templates\ProjectItems\MyCustomProject", 500)]
internal class MyUnconfiguredProject
{
///
/// The file extension used by your project type.
/// This does not include the leading period.
///
internal const string ProjectExtension = "llilumproj";
///
/// A project capability that is present in your project type and none others.
/// This is a convenient constant that may be used by your extensions so they
/// only apply to instances of your project type.
///
///
/// This value should be kept in sync with the capability as actually defined in your .targets.
///
internal const string UniqueCapability = "LlilumApplication";
internal const string Language = "LlilumApplication";
[ImportingConstructor]
public MyUnconfiguredProject(UnconfiguredProject unconfiguredProject)
{
this.ProjectHierarchies = new OrderPrecedenceImportCollection(projectCapabilityCheckProvider: unconfiguredProject);
}
[Import]
internal UnconfiguredProject UnconfiguredProject { get; }
[Import]
internal IActiveConfiguredProjectSubscriptionService SubscriptionService { get; }
[Import]
internal IThreadHandling ThreadHandling { get; }
[Import]
internal ActiveConfiguredProject ActiveConfiguredProject { get; }
[Import]
internal ActiveConfiguredProject MyActiveConfiguredProject { get; }
[ImportMany(ExportContractNames.VsTypes.IVsProject, typeof(IVsProject))]
internal OrderPrecedenceImportCollection ProjectHierarchies { get; }
internal IVsHierarchy ProjectHierarchy
{
get { return this.ProjectHierarchies.Single().Value; }
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/ProjectProperties.cs
================================================
namespace LlilumApplication
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.Properties;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
[Export]
[AppliesTo(MyUnconfiguredProject.UniqueCapability)]
internal partial class ProjectProperties : StronglyTypedPropertyAccess
{
///
/// Initializes a new instance of the class.
///
[ImportingConstructor]
public ProjectProperties(ConfiguredProject configuredProject)
: base(configuredProject)
{
}
///
/// Initializes a new instance of the class.
///
public ProjectProperties(ConfiguredProject configuredProject, string file, string itemType, string itemName)
: base(configuredProject, file, itemType, itemName)
{
}
///
/// Initializes a new instance of the class.
///
public ProjectProperties(ConfiguredProject configuredProject, IProjectPropertiesContext projectPropertiesContext)
: base(configuredProject, projectPropertiesContext)
{
}
///
/// Initializes a new instance of the class.
///
public ProjectProperties(ConfiguredProject configuredProject, UnconfiguredProject unconfiguredProject)
: base(configuredProject, unconfiguredProject)
{
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: Microsoft.VisualStudio.Shell.ProvideCodeBase(CodeBase = @"$PackageFolder$\LlilumApplication.dll")]
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LlilumApplication.ProjectType")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LlilumApplication.ProjectType")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e80f771d-7f9a-45a7-8b48-9db1dbb196e9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/VSPackage.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Llilum Application
Llilum Application Project Files (*.llilumproj);*.llilumproj
Llilum Application Items
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/VsPackage.cs
================================================
/***************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
***************************************************************************/
namespace LlilumApplication
{
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
///
/// This class implements the package exposed by this assembly.
///
///
/// This package is required if you want to define adds custom commands (ctmenu)
/// or localized resources for the strings that appear in the New Project and Open Project dialogs.
/// Creating project extensions or project types does not actually require a VSPackage.
///
[PackageRegistration(UseManagedResourcesOnly = true)]
[Description("A custom project type based on CPS")]
[Guid(VsPackage.PackageGuid)]
public sealed class VsPackage : Package
{
///
/// The GUID for this package.
///
public const string PackageGuid = "77dca561-ba37-4520-91a2-3adcff025ac2";
///
/// The GUID for this project type. It is unique with the project file extension and
/// appears under the VS registry hive's Projects key.
///
public const string ProjectTypeGuid = "4e46a113-0369-413e-9b70-97a179ba0b8e";
///
/// The file extension of this project type. No preceding period.
///
public const string ProjectExtension = "llilumproj";
///
/// The default namespace this project compiles with, so that manifest
/// resource names can be calculated for embedded resources.
///
internal const string DefaultNamespace = "LlilumApplication";
}
}
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/app.config
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/packages.config
================================================
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication/LlilumApplication.ProjectType/source.extension.vsixmanifest
================================================
Llilum Application VSIX
A template for creating a Llilum Application project.
https://github.com/NETMF/llilum
MITLicense.txt
================================================
FILE: VisualStudio/LlilumProjectType/LlilumApplication.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LlilumApplication.ProjectType", "LlilumApplication\LlilumApplication.ProjectType\LlilumApplication.ProjectType.csproj", "{74611D01-A97F-438C-B687-448FEEDBE4FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LlilumApplication.ProjectTemplate", "LlilumApplication\LlilumApplication.ProjectTemplate\LlilumApplication.ProjectTemplate.csproj", "{5747D247-5FCC-4151-942C-811603768ABE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.MIEngine.CoreRegisters.ARM", "Microsoft.MIEngine.CoreRegisters.ARM\Microsoft.MIEngine.CoreRegisters.ARM.csproj", "{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.MIEngine.CoreRegisters.ARMTests", "Microsoft.MIEngine.CoreRegisters.ARMTests\Microsoft.MIEngine.CoreRegisters.ARMTests.csproj", "{C37F80C6-2575-4CF8-999B-A38B1E8087AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{74611D01-A97F-438C-B687-448FEEDBE4FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74611D01-A97F-438C-B687-448FEEDBE4FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74611D01-A97F-438C-B687-448FEEDBE4FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74611D01-A97F-438C-B687-448FEEDBE4FB}.Release|Any CPU.Build.0 = Release|Any CPU
{5747D247-5FCC-4151-942C-811603768ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5747D247-5FCC-4151-942C-811603768ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5747D247-5FCC-4151-942C-811603768ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5747D247-5FCC-4151-942C-811603768ABE}.Release|Any CPU.Build.0 = Release|Any CPU
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}.Release|Any CPU.Build.0 = Release|Any CPU
{C37F80C6-2575-4CF8-999B-A38B1E8087AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C37F80C6-2575-4CF8-999B-A38B1E8087AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C37F80C6-2575-4CF8-999B-A38B1E8087AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C37F80C6-2575-4CF8-999B-A38B1E8087AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/Converters/ExceptionNumberConverter.cs
================================================
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
public class ExceptionNumberConverter
: IValueConverter
{
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
if( targetType != typeof( string ) )
return null;
var exceptionNum = ( int )value;
switch( exceptionNum )
{
case 0:
return "";
case 1:
return "Reset";
case 2:
return "NMI";
case 3:
return "HardFault";
case 4:
return "MemManage";
case 5:
return "BusFault";
case 6:
return "UsageFault";
case 7:
return "Reserved7";
case 8:
return "Reserved8";
case 9:
return "Reserved9";
case 10:
return "Reserved10";
case 11:
return "SvcCall";
case 12:
return "DebugMonitor";
case 13:
return "Reserved13";
case 14:
return "PendSV";
case 15:
return "SysTick";
default:
// TODO: make this extensible so that the UI can show actual SOC interrupt source names
return $"ExternalInt{exceptionNum - 16}";
}
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
throw new NotSupportedException( );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/Converters/IntAsBinaryStringConverter.cs
================================================
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
/// Value converter to convert an integer into a string of binary digits in groups of 4 digits separated by spaces
public class IntAsBinaryStringConverter
: IValueConverter
{
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
var bldr = new StringBuilder(32 + 7);// 32 digits plus 7 spaces
foreach( var c in GetBitChars( ( uint )value ) )
bldr.Append( c );
return bldr.ToString( );
}
// xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx
private IEnumerable GetBitChars( uint value )
{
var binString = System.Convert.ToString( value, 2 );
int bitIndex = 0;
for( var index = binString.Length - 32; index < binString.Length; ++index, ++bitIndex )
{
if( InsertDelimiter( bitIndex ) )
yield return ' ';
yield return index < 0 ? '0' : binString[ index ];
}
}
private static bool InsertDelimiter( int bitIndex )
{
return bitIndex != 0 && ( bitIndex % 4 == 0 ) && bitIndex <= 32;
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
throw new NotSupportedException( );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/Converters/IsNullValueConverter.cs
================================================
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
public class IsNullConverter : IValueConverter
{
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
return ( value == null );
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
throw new NotSupportedException( );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/CoreRegistersWindow.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
///
/// This class implements the tool window exposed by this package and hosts a user control.
///
///
/// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
/// usually implemented by the package implementer.
///
/// This class derives from the ToolWindowPane class provided from the MPF in order to use its
/// implementation of the IVsUIElementPane interface.
///
///
[Guid( "43a63d28-8723-4b55-9671-93597c2e78e5" )]
public class CoreRegistersWindow
: ToolWindowPane
{
///
/// Initializes a new instance of the class.
///
[SuppressMessage( "Warning", "VSSDK002", Justification = "Asserted via ThreadHelper.ThrowIfNotOnUIThread( )" )]
public CoreRegistersWindow( IServiceProvider svcProvider )
: base( svcProvider )
{
Caption = "CoreRegistersWindow";
ThreadHelper.ThrowIfNotOnUIThread( );
var debugger = ( IVsDebugger )GetService( typeof( SVsShellDebugger ) );
Debug.Assert( debugger != null );
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property. Setting it on a private field and overriding the
// Content property avoids the problem of calling a virtual in the constructor.
ContentControl = new CoreRegistersWindowControl( new CoreRegistersViewModel( debugger ) );
}
public override object Content
{
get
{
if( base.Content == null )
base.Content = ContentControl;
return base.Content;
}
set
{
base.Content = value;
}
}
private readonly CoreRegistersWindowControl ContentControl;
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/CoreRegistersWindowCommand.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.ComponentModel.Design;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
///
/// Command handler
///
internal sealed class CoreRegistersWindowCommand
{
///
/// Command ID.
///
public const int CommandId = 0x0100;
///
/// Command menu group (command set GUID).
///
public static readonly Guid CommandSet = new Guid( "8d5e2453-09b4-41bf-aa8d-7b6e1602a1c7" );
///
/// VS Package that provides this command, not null.
///
private readonly Package package;
private IVsMonitorSelection SelectionService;
private uint DebuggingContextCookie;
///
/// Initializes a new instance of the class.
/// Adds our command handlers for menu (commands must exist in the command table file)
///
/// Owner package, not null.
[SuppressMessage( "Warning","VSSDK002", Justification = "Checked via ThreadHelper.ThrowIfNotOnUIThread()")]
private CoreRegistersWindowCommand( Package package )
{
if( package == null )
{
throw new ArgumentNullException( nameof( package ) );
}
this.package = package;
ThreadHelper.ThrowIfNotOnUIThread( );
SelectionService = ( IVsMonitorSelection )Package.GetGlobalService( typeof( SVsShellMonitorSelection ) );
if( SelectionService == null )
return;
OleMenuCommandService commandService = ServiceProvider.GetService( typeof( IMenuCommandService ) ) as OleMenuCommandService;
if( commandService == null )
return;
var menuCommandID = new CommandID( CommandSet, CommandId );
var menuItem = new OleMenuCommand( ShowToolWindow, menuCommandID );
commandService.AddCommand( menuItem );
menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;
Guid tempGuid = VSConstants.UICONTEXT.Debugging_guid;
ErrorHandler.ThrowOnFailure( SelectionService.GetCmdUIContextCookie( ref tempGuid, out DebuggingContextCookie ) );
}
[SuppressMessage( "Warning", "VSSDK002", Justification = "UI thread callback, always on UI" )]
private void MenuItem_BeforeQueryStatus( object sender, EventArgs e )
{
var cmd = ( OleMenuCommand )sender;
int active = 0;
ErrorHandler.ThrowOnFailure( SelectionService.IsCmdUIContextActive( DebuggingContextCookie, out active ) );
cmd.Visible = active != 0;
}
///
/// Gets the instance of the command.
///
public static CoreRegistersWindowCommand Instance { get; private set; }
///
/// Gets the service provider from the owner package.
///
private IServiceProvider ServiceProvider => package;
///
/// Initializes the singleton instance of the command.
///
/// Owner package, not null.
public static void Initialize( Package package )
{
Instance = new CoreRegistersWindowCommand( package );
}
///
/// Shows the tool window when the menu item is clicked.
///
/// The event sender.
/// The event args.
[SuppressMessage( "Warning", "VSSDK002", Justification = "UI thread callback, always on UI" )]
private void ShowToolWindow( object sender, EventArgs e )
{
// Get the instance number 0 of this tool window. This window is single instance so this instance
// is actually the only one.
// The last flag is set to true so that if the tool window does not exists it will be created.
ToolWindowPane window = package.FindToolWindow( typeof( CoreRegistersWindow ), 0, true );
if( ( null == window ) || ( null == window.Frame ) )
{
throw new NotSupportedException( "Cannot create tool window" );
}
IVsWindowFrame windowFrame = ( IVsWindowFrame )window.Frame;
ErrorHandler.ThrowOnFailure( windowFrame.Show( ) );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/CoreRegistersWindowControl.xaml
================================================
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/CoreRegistersWindowControl.xaml.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
/// Interaction logic for CoreRegistersWindowControl.
public partial class CoreRegistersWindowControl
{
/// Initializes a new instance of the class.
internal CoreRegistersWindowControl( CoreRegistersViewModel context )
{
DataContext = context;
InitializeComponent( );
ICollectionView view = CollectionViewSource.GetDefaultView( RegistersView.ItemsSource );
view.GroupDescriptions.Add( new PropertyGroupDescription( "Group" ) );
}
}
public class RegisterDetailsTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate( object item, DependencyObject container )
{
var element = container as FrameworkElement;
var register = item as CoreRegisterViewModel;
if( element == null || register == null )
return null;
var templateName = register.Name == "xpsr" ? "XpsrRegisterDetailsViewModelTemplate" : "DefaultRegisterDetailsTemplate";
return element.FindResource( templateName ) as DataTemplate;
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/MIEngineResultsParsers.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Sprache;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Threading;
namespace Microsoft.MIEngine.Extensions
{
/// Represents a parsed registerId and value pair from the MI response
public struct RegisterIdValuePair
{
public RegisterIdValuePair( int id, uint value )
{
Id = id;
Value = value;
}
public int Id { get; }
public uint Value { get; }
}
/// Represents a parsed registerId and value pair from the MI response
public struct RegisterIdNamePair
{
public RegisterIdNamePair( int id, string name )
{
Id = id;
Name = name;
}
public int Id { get; }
public string Name { get; }
}
/// Represents the result status of a command response
public enum ResultStatus
{
Done,
Connected,
Error,
Exit
}
/// Base class for parsed engine results
public class MIEngineResult
{
protected MIEngineResult( ResultStatus status )
{
Status = status;
}
/// Status parsed from the response
public ResultStatus Status { get; }
}
/// Result of parsing a '-data-list-register-values x' command
public class RegisterValuesResult
: MIEngineResult
{
internal RegisterValuesResult( ResultStatus status, IEnumerable registers )
: base( status )
{
// NOTE: ToList() is run here to support Async scenarios by forcing
// the list enumeration at the time this result is created instead
// of some point later when the Registers property is read on some
// other thread.
Registers = registers.ToList( ).AsReadOnly( );
}
public IReadOnlyList Registers { get; }
public static Task ParseAsync( string resultTxt ) => MIEngineResultParsers.ParseRegisterValuesResultAsync( resultTxt );
public static string GetCommand( ) => GetCommand( new int[0] );
public static string GetCommand( IReadOnlyList registers )
{
var regArg = string.Join( " ", registers.Select( ( i ) => i.ToString( ) ) );
return $"-data-list-register-values x {regArg}";
}
}
/// Parses the result of a '-data-list-changed-registers' command
public class ChangedRegistersResult
: MIEngineResult
{
internal ChangedRegistersResult( ResultStatus status, IEnumerable registers )
: base( status )
{
// NOTE: ToList() is run here to support Async scenarios by forcing
// the list enumeration at the time this result is created instead
// of some point later when the Registers property is read on some
// other thread.
Registers = registers.ToList( ).AsReadOnly( );
}
public IReadOnlyList Registers { get; }
public static Task ParseAsync( string resultTxt ) => MIEngineResultParsers.ParseChangedRegistersResultAsync( resultTxt );
public const string Command = "-data-list-changed-registers";
}
/// Parses the result of a '-data-list-register-names' command
public class RegisterNamesResult
: MIEngineResult
{
internal RegisterNamesResult( ResultStatus status, IEnumerable names )
: base( status )
{
var regNames = from regId in names.Select( ( n, i ) => new RegisterIdNamePair( i, n ) )
where !string.IsNullOrEmpty( regId.Name )
select regId;
// NOTE: ToList() is run here to support Async scenarios by forcing
// the list enumeration at the time this result is created instead
// of some point later when the Names property is read on some
// other thread.
Names = regNames.ToList( ).AsReadOnly( );
}
public IReadOnlyList Names { get; }
public static Task ParseAsync( string resultTxt ) => MIEngineResultParsers.ParseRegisterNamesResultAsync( resultTxt );
public const string Command = "-data-list-register-names";
}
/// Internal parsers for parsing the textual results from commands sent via MIEngine
///
/// The parsers are built using Parser Combinators built from the Sprache parser library (Nuget package - Apache Lic. )
/// The combinators help simplify the task of parsing the string results into a useable form at runtime whithout the
/// need of complex Regular Expressions or a full blown ANTLR sylte parser.
/// It is important to note that the format of the texual response from the MIEngine isn't the actual
/// GDB Machine Interface (MI) form. The MIEngine will parse the actual MI result to present a human readable response,
/// which is what these parsers take as input. This is due to the fact that the raw MI form is not exposed outside the
/// MIEngine itself but the human readable for is thanks to the Debug.MIDebugExec command.
///
public static class MIEngineResultParsers
{
public static async Task ParseRegisterValuesResultAsync( string resultTxt )
{
await TaskScheduler.Default;
return RegisterValuesResultParser.Parse( resultTxt );
}
public static async Task ParseChangedRegistersResultAsync( string resultTxt )
{
await TaskScheduler.Default;
return ChangedRegistersResultParser.Parse( resultTxt );
}
public static async Task ParseRegisterNamesResultAsync( string resultTxt )
{
await TaskScheduler.Default;
return RegisterNamesResultParser.Parse( resultTxt );
}
#region Primitive Parser Combinators
// parses a single hex digit
private static readonly Parser HexDigit
= Parse.Digit.Or( Parse.Chars( 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F' ) );
// parses a register name (doesn't currently allow underscores or dashes but that doesn't appear to be necessary...)
private static readonly Parser> RegisterName
= Parse.Identifier( Parse.Letter, Parse.LetterOrDigit )
.Optional( )
.Token();
// parses a decimal integer as an int
private static readonly Parser DecimalInteger
= ( from val in Parse.Digit.AtLeastOnce( ).Text( ).Token( )
select int.Parse( val )
).Token( );
// parses a '0x' prefixed hexadecimal number as an unsigned 32 bit integer
private static readonly Parser HexInteger
= ( from prefix in Parse.String( "0x" )
from val in HexDigit.AtLeastOnce( ).Text( ).Token( )
select Convert.ToUInt32( val, 16 )
).Token();
// parses double quoted text
private static readonly Parser QuotedText
= ( from open in Parse.Char( '"' )
from content in Parse.CharExcept( '"' ).Many( ).Text( )
from close in Parse.Char( '"' )
select content
).Token( );
// Factory method for building name=value pair parser combinators
private static Parser> NameValuePair( string name, Parser valueParser )
{
return ( from key in Parse.String( name ).Text( ).Token( )
from eq in Parse.Char( '=' ).Token( )
from value in valueParser
select new KeyValuePair( key, value )
).Token( );
}
#endregion
#region MIEngine result string parsers
// parses an MI register id and value pair
private static readonly Parser RegisterValue
= from lbrace in Parse.Char( '{' ).Token( )
from num in NameValuePair( "number", DecimalInteger )
from comma in Parse.Char( ',' ).Token( )
from val in NameValuePair( "value", HexInteger )
from rbrace in Parse.Char( '}' )
select new RegisterIdValuePair( num.Value, val.Value );
// parses the MIEngine result line
private static readonly Parser ResultClass
= from label in Parse.String( "result-class:" ).Token( )
from kind in Parse.String( "done" ).Return( ResultStatus.Done )
.Or( Parse.String( "error" ).Return( ResultStatus.Error ) )
.Or( Parse.String( "exit" ).Return( ResultStatus.Exit ) )
.Or( Parse.String( "connected" ).Return( ResultStatus.Connected ) )
from trailing in Parse.WhiteSpace.Optional( )
from eol in Parse.LineEnd
select kind;
// parses the result string from a '-data-list-register-values x' command
private static readonly Parser RegisterValuesResultParser
= ( from kind in ResultClass
from label in Parse.String( "register-values:" ).Token( )
from lbracket in Parse.Char( '[' ).Token( )
from registers in RegisterValue.DelimitedBy( Parse.Char( ',' ).Token( ) )
from rbracket in Parse.Char( ']' ).Token( )
select new RegisterValuesResult( kind, registers )
).End( );
// parses the result string from a '-data-list-changed-registers' command
private static readonly Parser ChangedRegistersResultParser
= ( from kind in ResultClass
from label in Parse.String( "changed-registers:" ).Token( )
from lbracket in Parse.Char( '[' ).Token( )
from registers in DecimalInteger.DelimitedBy( Parse.Char( ',' ).Token( ) )
from rbracket in Parse.Char( ']' ).Token( )
select new ChangedRegistersResult( kind, registers )
).End( );
// parses the result string from a '-data-list-register-names' command
private static readonly Parser RegisterNamesResultParser
= ( from kind in ResultClass
from label in Parse.String( "register-names:" ).Token( )
from lbracket in Parse.Char( '[' ).Token( )
from registers in RegisterName.DelimitedBy( Parse.Char( ',' ).Token( ) )
from rbracket in Parse.Char( ']' ).Token( )
select new RegisterNamesResult( kind, registers.Select( r=>r.IsEmpty ? string.Empty : r.Get() ) )
).End( );
#endregion
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/MITLicense.txt
================================================
The MIT License (MIT)
Copyright (c) 2015 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/Microsoft.MIEngine.CoreRegisters.ARM.csproj
================================================
14.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
true
true
Key.snk
Debug
AnyCPU
2.0
{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}
Library
Properties
Microsoft.MIEngine.CoreRegisters.ARM
Microsoft.MIEngine.CoreRegisters.ARM
v4.5.2
true
true
true
true
true
false
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
pdbonly
true
bin\Release\
TRACE
prompt
4
CoreRegistersWindowControl.xaml
Designer
False
False
False
False
$(MSBuildProgramFiles32)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\MDD\Debugger\Microsoft.MIDebugEngine.dll
False
..\packages\Microsoft.VisualStudio.Imaging.14.0.23107\lib\net45\Microsoft.VisualStudio.Imaging.dll
True
..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll
True
..\packages\Microsoft.VisualStudio.Shell.14.0.14.0.23107\lib\Microsoft.VisualStudio.Shell.14.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.0.23107\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll
True
True
..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll
True
True
..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll
True
True
..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll
True
..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll
True
..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll
True
..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll
True
..\packages\Microsoft.VisualStudio.Threading.14.0.50702\lib\net45\Microsoft.VisualStudio.Threading.dll
True
..\packages\Microsoft.VisualStudio.Utilities.14.0.23107\lib\net45\Microsoft.VisualStudio.Utilities.dll
True
..\packages\Microsoft.VisualStudio.Validation.14.0.50702\lib\net45\Microsoft.VisualStudio.Validation.dll
True
..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll
True
False
Menus.ctmenu
VsPackage.cs
true
VSPackage
MSBuild:Compile
Designer
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "Microsoft.MIEngine.CoreRegisters.ARM" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "Microsoft.MIEngine.CoreRegisters.ARM" )]
[assembly: AssemblyCopyright( "" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
[assembly: InternalsVisibleTo( "Microsoft.MIEngine.CoreRegisters.ARM.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010021418abe4dcdc112c52bd042e37e668db02edd6db60b8ed26825578ea37f8d148084323543757f1986c94c852944e2a59ddf7455f7f32d70e41b999c729fab9d0410cecda09ccace57556f5390d0fda83f016b3a151d8101345d75f057af2dc2402c8fcbe94595461502f78983509a68337dc82529f769777c6d6527fb7190cb" )]
[assembly: InternalsVisibleTo( "Microsoft.MIEngine.CoreRegisters.ARM.Explorables, PublicKey=002400000480000094000000060200000024000052534131000400000100010021418abe4dcdc112c52bd042e37e668db02edd6db60b8ed26825578ea37f8d148084323543757f1986c94c852944e2a59ddf7455f7f32d70e41b999c729fab9d0410cecda09ccace57556f5390d0fda83f016b3a151d8101345d75f057af2dc2402c8fcbe94595461502f78983509a68337dc82529f769777c6d6527fb7190cb" )]
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/VSPackage.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Microsoft MIEngine extension for viewing ARM(R) Core registers
This package privides visibility of Core CPU registers borken down to individual bit fields where appropriate
Resources\VsPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/ViewModel/CoreRegisterViewModel.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.ComponentModel;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
public class CoreRegisterViewModel
: INotifyPropertyChanged
{
public CoreRegisterViewModel( string name, string group, int id )
: this( name, group, id, null )
{
}
public CoreRegisterViewModel( string name, string group, int id, Func detailFactory )
{
Name = name;
Group = group;
Id = id;
Value = 0;
if( detailFactory != null )
Details = detailFactory( this );
}
public event PropertyChangedEventHandler PropertyChanged = delegate {};
public string Name { get; }
public uint Value
{
get { return Value_; }
internal set
{
Value_ = value;
PropertyChanged( this, ValueChangedEventArgs );
IsChanged = true;
}
}
uint Value_;
public object Details { get; }
public string Group { get; }
public int Id { get; }
public bool IsChanged
{
get { return IsChanged_; }
internal set
{
IsChanged_ = value;
PropertyChanged( this, IsChangedEventArgs );
}
}
private bool IsChanged_;
private static readonly PropertyChangedEventArgs IsChangedEventArgs = new PropertyChangedEventArgs( nameof( IsChanged ) );
private static readonly PropertyChangedEventArgs ValueChangedEventArgs = new PropertyChangedEventArgs( nameof( Value ) );
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/ViewModel/CoreRegistersViewModel.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.MIDebugEngine;
using Microsoft.MIEngine.Extensions;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
internal sealed class CoreRegistersViewModel
: INotifyPropertyChanged
, IVsDebuggerEvents
, IDisposable
{
[SuppressMessage("Warning", "VSSDK002", Justification = "Asserted via ThreadHelper.ThrowIfNotOnUIThread( )")]
internal CoreRegistersViewModel( IVsDebugger debugger )
{
if( debugger == null )
throw new ArgumentNullException( nameof( debugger ) );
Registers = new List
{ new CoreRegisterViewModel("R0", "Core", 0)
, new CoreRegisterViewModel("R1", "Core", 1)
, new CoreRegisterViewModel("R2", "Core", 2)
, new CoreRegisterViewModel("R3", "Core", 3)
, new CoreRegisterViewModel("R4", "Core", 4)
, new CoreRegisterViewModel("R5", "Core", 5)
, new CoreRegisterViewModel("R6", "Core", 6)
, new CoreRegisterViewModel("R7", "Core", 7)
, new CoreRegisterViewModel("R8", "Core", 8)
, new CoreRegisterViewModel("R9", "Core", 9)
, new CoreRegisterViewModel("R10", "Core", 10)
, new CoreRegisterViewModel("R11", "Core", 11)
, new CoreRegisterViewModel("R12", "Core", 12)
, new CoreRegisterViewModel("R13(SP)", "Core", 13)
, new CoreRegisterViewModel("R14(LR)", "Core", 14)
, new CoreRegisterViewModel("R15(PC)", "Core", 15)
, new CoreRegisterViewModel("xpsr", "Core", 0x19, (r)=>new XpsrRegisterDetailsViewModel(r) )
, new CoreRegisterViewModel("msp", "Banked", 0x5B)
, new CoreRegisterViewModel("psp", "Banked", 0x5C)
, new CoreRegisterViewModel("primask", "System", 0x5D)
, new CoreRegisterViewModel("control", "System", 0x5E)
, new CoreRegisterViewModel("basepri", "System", 0x5F)
, new CoreRegisterViewModel("faultmask", "System", 0x60)
};
RegIdToViewModelMap = Registers.ToDictionary( vm => vm.Id );
ThreadHelper.ThrowIfNotOnUIThread( );
Debugger = debugger;
Debugger.AdviseDebuggerEvents( this, out DebuggerEventsSinkCookie );
}
public string DebugMode { get; private set; }
public event PropertyChangedEventHandler PropertyChanged = delegate {};
public List Registers { get; }
public void Dispose( )
{
ThreadHelper.ThrowIfNotOnUIThread( );
Debugger.UnadviseDebuggerEvents( DebuggerEventsSinkCookie );
}
int IVsDebuggerEvents.OnModeChange( DBGMODE dbgmodeNew )
{
// Push actual handler activity to the UI thread, if not already there
// Run Async is needed since this is an interface defined method that
// isn't async aware.
ThreadHelper.JoinableTaskFactory.RunAsync( async ()=>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync( );
DebugMode = dbgmodeNew.ToString( );
PropertyChanged( this, DebugModeChangedEventArgs );
if( dbgmodeNew != DBGMODE.DBGMODE_Break )
return;
foreach( var knownReg in RegIdToViewModelMap.Values )
knownReg.IsChanged = false;
var registers = await GetUpdatedRegistersAsync( );
foreach( var reg in registers )
RegIdToViewModelMap[ reg.Id ].Value = reg.Value;
});
return VSConstants.S_OK;
}
internal async Task< IReadOnlyList > GetUpdatedRegistersAsync( )
{
#if DEBUG
await VerifyRegisterIds( );
#endif
string cmdResult = await MIDebugCommandDispatcher.ExecuteCommand( ChangedRegistersResult.Command );
var regChangedResult = await ChangedRegistersResult.ParseAsync( cmdResult );
// if( regChangedResult.Status != ResultStatus.Done )
// TODO: How should errors be reported?
// send a request for the values of the changed registers
var cmd = RegisterValuesResult.GetCommand( regChangedResult.Registers );
cmdResult = await MIDebugCommandDispatcher.ExecuteCommand( cmd );
var regValues = await RegisterValuesResult.ParseAsync( cmdResult );
//if( regValues.Status != ResultStatus.Done )
// TODO: How should errors be reported?
return regValues.Registers;
}
private readonly Dictionary RegIdToViewModelMap;
private readonly IVsDebugger Debugger;
private readonly uint DebuggerEventsSinkCookie;
private static readonly PropertyChangedEventArgs DebugModeChangedEventArgs = new PropertyChangedEventArgs( nameof( DebugMode ) );
#if DEBUG
// request all register names and ids, validate that all core registers
// have a matching view model
private async Task VerifyRegisterIds( )
{
if( VerifiedRegisterIds )
return;
string cmdResult = await MIDebugCommandDispatcher.ExecuteCommand( RegisterNamesResult.Command );
var result = await RegisterNamesResult.ParseAsync( cmdResult );
if( result.Status != ResultStatus.Done )
return;
foreach( var regNameId in result.Names )
{
Debug.Assert( RegIdToViewModelMap.ContainsKey( regNameId.Id ) );
}
VerifiedRegisterIds = true;
}
bool VerifiedRegisterIds;
#endif
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/ViewModel/XpsrRegisterDetailsViewModel.cs
================================================
using System.ComponentModel;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
public class XpsrRegisterDetailsViewModel
: INotifyPropertyChanged
{
public XpsrRegisterDetailsViewModel( CoreRegisterViewModel vm )
{
Register = vm;
PropertyChangedEventManager.AddHandler( vm, RegValueChanged, nameof( vm.Value ) );
}
public event PropertyChangedEventHandler PropertyChanged = delegate { };
private void RegValueChanged( object sender, PropertyChangedEventArgs e )
{
var val = Register.Value;
N = ( val & NBitMask ) != 0;
Z = ( val & ZBitMask ) != 0;
C = ( val & CBitMask ) != 0;
V = ( val & VBitMask ) != 0;
Q = ( val & QBitMask ) != 0;
ExceptionNum = ( int )( val & ExceptionMask );
PropertyChanged( this, AllPropertiesChangedEventArgs );
}
public bool N { get; private set; }
public bool Z { get; private set; }
public bool C { get; private set; }
public bool V { get; private set; }
public bool Q { get; private set; }
public int ExceptionNum { get; private set; }
private readonly CoreRegisterViewModel Register;
// see ARM-V7M Arch manual (B1.4.2)
private const uint NBitMask = 1u << 31;
private const uint ZBitMask = 1u << 30;
private const uint CBitMask = 1u << 29;
private const uint VBitMask = 1u << 28;
private const uint QBitMask = 1u << 27;
private const uint ExceptionMask = 0x1FF;
private static readonly PropertyChangedEventArgs AllPropertiesChangedEventArgs = new PropertyChangedEventArgs( string.Empty );
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/VsPackage.cs
================================================
// The MIT License( MIT)
//
// Copyright( c) 2015 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel.Design;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Microsoft.MIEngine.CoreRegisters.ARM
{
///
/// This is the class that implements the package exposed by this assembly.
///
///
///
/// The minimum requirement for a class to be considered a valid package for Visual Studio
/// is to implement the IVsPackage interface and register itself with the shell.
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
/// to do it: it derives from the Package class that provides the implementation of the
/// IVsPackage interface and uses the registration attributes defined in the framework to
/// register itself and its components with the shell. These attributes tell the pkgdef creation
/// utility what data to put into .pkgdef file.
///
///
/// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file.
///
///
[PackageRegistration( UseManagedResourcesOnly = true )]
[InstalledProductRegistration( "#110", "#112", "1.0", IconResourceID = 400 )] // Info on this package for Help/About
[Guid( PackageGuidString )]
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideToolWindow(typeof(CoreRegistersWindow))]
[SuppressMessage( "StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms" )]
public sealed class VsPackage
: Package
{
/// The GUID for this package.
public const string PackageGuidString = "217e9e56-991f-400f-ad67-89ff15e0adee";
///
/// Initializes a new instance of the class.
///
public VsPackage( )
{
// Inside this method you can place any initialization code that does not require
// any Visual Studio service because at this point the package object is created but
// not sited yet inside Visual Studio environment. The place to do all the other
// initialization is the Initialize method.
}
///
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
///
protected override void Initialize( )
{
base.Initialize( );
IServiceContainer svcContainer = this;
CoreRegistersWindowCommand.Initialize( this );
}
// base implementation uses default constructor, need to override to make service provider available
// to the tool window being created
protected override WindowPane InstantiateToolWindow( Type toolWindowType )
{
return ( WindowPane )Activator.CreateInstance( toolWindowType, ( IServiceProvider )this );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/VsPackage.vsct
================================================
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/packages.config
================================================
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARM/source.extension.vsixmanifest
================================================
Microsoft.MIEngine.CoreRegisters.ARM
Empty VSIX Project.
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARMTests/IntAsBinaryStringConverterTests.cs
================================================
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Globalization;
namespace Microsoft.MIEngine.CoreRegisters.ARM.Tests
{
[TestClass( )]
public class IntAsBinaryStringConverterTests
{
[TestMethod( )]
public void ConvertTest( )
{
var converter = new IntAsBinaryStringConverter( );
var result = converter.Convert( 0x12345678U, typeof( string ), null, CultureInfo.InvariantCulture );
Assert.IsNotNull( result );
var resultString = result as string;
Assert.IsNotNull( resultString );
Assert.AreEqual( "0001 0010 0011 0100 0101 0110 0111 1000", resultString );
}
[TestMethod]
[ExpectedException( typeof( NotSupportedException ) )]
public void ConvertBackTest( )
{
var converter = new IntAsBinaryStringConverter( );
converter.ConvertBack( "1111 0000 1111 0000 1111 0000 1111 0000", typeof( uint ), null, CultureInfo.InvariantCulture );
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARMTests/MIEngineResultParsersTests.cs
================================================
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.MIEngine.Extensions.Tests
{
[TestClass]
public class MIEngineResultParsersTests
{
const string ValidRegValueTestInput = "result-class: done\r\n"
+ "register-values: [{number=0, value=0x10006210},{number=1,value=0x0},{number=2,value=0x40000},{number=3,value=0xf014},{number=4,value=0x3f00f707},{number=5,value=0x1000335c},{number=6,value=0x0},{number=7,value=0x3fe00000},{number=8,value=0x10003330},{number=9,value=0x1},{number=10,value=0x0},{number=11,value=0x10001b9c},{number=12,value=0xf000},{number=13,value=0x10006180},{number=14,value=0x9357},{number=15,value=0x385c},{number=25,value=0x1000000},{number=91,value=0x10007fb0},{number=92,value=0x10006180},{number=93,value=0x0},{number=94,value=0x2},{number=95,value=0xf8},{number=96,value=0x0}]";
const string ValidRegisterNamesTestInput = "result-class: done\r\n"
+ "register-names: [r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,sp,lr,pc,,,,,,,,,,xpsr,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,msp,psp,primask,control,basepri,faultmask]";
const string ErrorMsgResultTestInput = "result-class: error\r\n"
+ "msg: -data-list-register-values: Usage: -data-list-register-values [--skip-unavailable] [...]";
const string IncompleteResult = "result-class: done\r\n";
static readonly RegisterIdNamePair[] Registers = {
new RegisterIdNamePair( 0 , "r0" ),
new RegisterIdNamePair( 1 , "r1"),
new RegisterIdNamePair( 2 , "r2"),
new RegisterIdNamePair( 3 , "r3"),
new RegisterIdNamePair( 4 , "r4"),
new RegisterIdNamePair( 5 , "r5"),
new RegisterIdNamePair( 6 , "r6"),
new RegisterIdNamePair( 7 , "r7"),
new RegisterIdNamePair( 8 , "r8"),
new RegisterIdNamePair( 9 , "r9"),
new RegisterIdNamePair( 10, "r10"),
new RegisterIdNamePair( 11, "r11"),
new RegisterIdNamePair( 12, "r12"),
new RegisterIdNamePair( 13, "sp"),
new RegisterIdNamePair( 14, "lr"),
new RegisterIdNamePair( 15, "pc"),
new RegisterIdNamePair( 25, "xpsr"),
new RegisterIdNamePair( 91, "msp"),
new RegisterIdNamePair( 92, "psp"),
new RegisterIdNamePair( 93, "primask"),
new RegisterIdNamePair( 94, "control"),
new RegisterIdNamePair( 95, "basepri"),
new RegisterIdNamePair( 96, "faultmask")
};
[ TestMethod ]
public void ParseRegisterValuesResultAsyncTest( )
{
var parsedResult = MIEngineResultParsers.ParseRegisterValuesResultAsync( ValidRegValueTestInput ).Result;
Assert.IsNotNull( parsedResult );
Assert.AreEqual( ResultStatus.Done, parsedResult.Status );
Assert.AreEqual( 23, parsedResult.Registers.Count );
CheckRegisterValue( parsedResult.Registers[ 0 ], 0, 0x10006210);
CheckRegisterValue( parsedResult.Registers[ 1 ], 1, 0x0);
CheckRegisterValue( parsedResult.Registers[ 2 ], 2, 0x40000);
CheckRegisterValue( parsedResult.Registers[ 3 ], 3, 0xf014);
CheckRegisterValue( parsedResult.Registers[ 4 ], 4, 0x3f00f707);
CheckRegisterValue( parsedResult.Registers[ 5 ], 5, 0x1000335c);
CheckRegisterValue( parsedResult.Registers[ 6 ], 6, 0x0);
CheckRegisterValue( parsedResult.Registers[ 7 ], 7, 0x3fe00000);
CheckRegisterValue( parsedResult.Registers[ 8 ], 8, 0x10003330);
CheckRegisterValue( parsedResult.Registers[ 9 ], 9, 0x1);
CheckRegisterValue( parsedResult.Registers[ 10 ], 10, 0x0);
CheckRegisterValue( parsedResult.Registers[ 11 ], 11, 0x10001b9c);
CheckRegisterValue( parsedResult.Registers[ 12 ], 12, 0xf000);
CheckRegisterValue( parsedResult.Registers[ 13 ], 13, 0x10006180);
CheckRegisterValue( parsedResult.Registers[ 14 ], 14, 0x9357);
CheckRegisterValue( parsedResult.Registers[ 15 ], 15, 0x385c);
CheckRegisterValue( parsedResult.Registers[ 16 ], 25, 0x1000000);
CheckRegisterValue( parsedResult.Registers[ 17 ], 91, 0x10007fb0);
CheckRegisterValue( parsedResult.Registers[ 18 ], 92, 0x10006180);
CheckRegisterValue( parsedResult.Registers[ 19 ], 93, 0x0);
CheckRegisterValue( parsedResult.Registers[ 20 ], 94, 0x2);
CheckRegisterValue( parsedResult.Registers[ 21 ], 95, 0xf8);
CheckRegisterValue( parsedResult.Registers[ 22 ], 96, 0x0);
}
[TestMethod]
public void ParseRegisterValuePartialInputTest( )
{
bool exceptionOccurred = false;
try
{
var parsedResult = MIEngineResultParsers.ParseRegisterValuesResultAsync( IncompleteResult ).Result;
}
catch(AggregateException ex)
{
Assert.IsInstanceOfType( ex.InnerException, typeof( Sprache.ParseException ) );
exceptionOccurred = true;
}
Assert.IsTrue( exceptionOccurred );
}
private static void CheckRegisterValue( RegisterIdValuePair x, int expectedIndex, uint expectedValue )
{
Assert.AreEqual( expectedIndex, x.Id );
Assert.AreEqual( expectedValue, x.Value );
}
[TestMethod( )]
public void ParseChangedRegistersResultAsyncTest( )
{
Assert.Inconclusive( );
}
[TestMethod( )]
public void ParseRegisterNamesResultAsyncTest( )
{
var parsedResult = MIEngineResultParsers.ParseRegisterNamesResultAsync( ValidRegisterNamesTestInput ).Result;
Assert.IsNotNull( parsedResult );
Assert.AreEqual( ResultStatus.Done, parsedResult.Status );
Assert.AreEqual( Registers.Length, parsedResult.Names.Count );
for( int i = 0; i < Registers.Length; ++i )
{
Assert.AreEqual( Registers[ i ].Id, parsedResult.Names[ i ].Id );
Assert.AreEqual( Registers[ i ].Name, parsedResult.Names[ i ].Name );
}
}
}
}
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARMTests/Microsoft.MIEngine.CoreRegisters.ARMTests.csproj
================================================
Debug
AnyCPU
{C37F80C6-2575-4CF8-999B-A38B1E8087AC}
Library
Properties
Microsoft.MIEngine.CoreRegisters.ARMTests
Microsoft.MIEngine.CoreRegisters.ARMTests
v4.5.2
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
False
UnitTest
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
pdbonly
true
bin\Release\
TRACE
prompt
4
..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll
True
{80F61FFD-C936-4528-BBC3-5DEE0782EBE5}
Microsoft.MIEngine.CoreRegisters.ARM
False
False
False
False
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARMTests/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "Microsoft.MIEngine.CoreRegisters.ARMTests" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "Microsoft.MIEngine.CoreRegisters.ARMTests" )]
[assembly: AssemblyCopyright( "Copyright © 2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "c37f80c6-2575-4cf8-999b-a38b1e8087ac" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: VisualStudio/LlilumProjectType/Microsoft.MIEngine.CoreRegisters.ARMTests/packages.config
================================================
================================================
FILE: Zelig/BoardConfigurations/BoardConfigurations.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LPC1768Configuration", "LPC1768\Configuration\LPC1768Configuration.csproj", "{C17E59D0-2D64-4012-8A98-D184D0CF8A49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "K64FConfiguration", "K64F\Configuration\K64FConfiguration.csproj", "{9863D039-AB21-4710-960E-7303919552C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "K64F", "K64F\Board\K64F.csproj", "{1705887B-E636-4FA3-AE40-2D431AF1511C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LPC1768", "LPC1768\Board\LPC1768.csproj", "{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LPC1768", "LPC1768", "{5100FF29-2B10-4D43-822F-DEDE105433FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "K64F", "K64F", "{5C328A57-B790-4B02-A36C-4EDA8280BA51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "STM32L152", "STM32L152", "{582F3F68-6C35-48E6-BC68-139AE9666F64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32L152", "STM32L152\Board\STM32L152.csproj", "{F0229144-F7C4-4456-8442-5E816C6E8FBC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32L152Configuration", "STM32L152\Configuration\STM32L152Configuration.csproj", "{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "STM32F411", "STM32F411", "{3F416416-1AEE-4F13-B338-917087AF0C54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F411", "STM32F411\Board\STM32F411.csproj", "{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F411Configuration", "STM32F411\Configuration\STM32F411Configuration.csproj", "{9B0EDB62-1E62-492D-B807-A8501EEE8400}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "STM32F401", "STM32F401", "{BE299041-AFCA-44FE-8556-EEC89F85005F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F401", "STM32F401\Board\STM32F401.csproj", "{6194144A-F8B1-4525-829F-061DF4A5645A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F401Configuration", "STM32F401\Configuration\STM32F401Configuration.csproj", "{7F600371-17AB-41F2-96AB-39C8AA2389E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "STM32F091", "STM32F091", "{67586B48-76A8-4D65-A3AC-C89D7A8774E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F091", "STM32F091\Board\STM32F091.csproj", "{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STM32F091Configuration", "STM32F091\Configuration\STM32F091Configuration.csproj", "{C183991C-1F27-4665-A884-FD977D2AD359}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C17E59D0-2D64-4012-8A98-D184D0CF8A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C17E59D0-2D64-4012-8A98-D184D0CF8A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C17E59D0-2D64-4012-8A98-D184D0CF8A49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C17E59D0-2D64-4012-8A98-D184D0CF8A49}.Release|Any CPU.Build.0 = Release|Any CPU
{9863D039-AB21-4710-960E-7303919552C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9863D039-AB21-4710-960E-7303919552C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9863D039-AB21-4710-960E-7303919552C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9863D039-AB21-4710-960E-7303919552C6}.Release|Any CPU.Build.0 = Release|Any CPU
{1705887B-E636-4FA3-AE40-2D431AF1511C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1705887B-E636-4FA3-AE40-2D431AF1511C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1705887B-E636-4FA3-AE40-2D431AF1511C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1705887B-E636-4FA3-AE40-2D431AF1511C}.Release|Any CPU.Build.0 = Release|Any CPU
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}.Release|Any CPU.Build.0 = Release|Any CPU
{F0229144-F7C4-4456-8442-5E816C6E8FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0229144-F7C4-4456-8442-5E816C6E8FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0229144-F7C4-4456-8442-5E816C6E8FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0229144-F7C4-4456-8442-5E816C6E8FBC}.Release|Any CPU.Build.0 = Release|Any CPU
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}.Release|Any CPU.Build.0 = Release|Any CPU
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}.Release|Any CPU.Build.0 = Release|Any CPU
{9B0EDB62-1E62-492D-B807-A8501EEE8400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B0EDB62-1E62-492D-B807-A8501EEE8400}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B0EDB62-1E62-492D-B807-A8501EEE8400}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B0EDB62-1E62-492D-B807-A8501EEE8400}.Release|Any CPU.Build.0 = Release|Any CPU
{6194144A-F8B1-4525-829F-061DF4A5645A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6194144A-F8B1-4525-829F-061DF4A5645A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6194144A-F8B1-4525-829F-061DF4A5645A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6194144A-F8B1-4525-829F-061DF4A5645A}.Release|Any CPU.Build.0 = Release|Any CPU
{7F600371-17AB-41F2-96AB-39C8AA2389E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F600371-17AB-41F2-96AB-39C8AA2389E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F600371-17AB-41F2-96AB-39C8AA2389E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F600371-17AB-41F2-96AB-39C8AA2389E1}.Release|Any CPU.Build.0 = Release|Any CPU
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}.Release|Any CPU.Build.0 = Release|Any CPU
{C183991C-1F27-4665-A884-FD977D2AD359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C183991C-1F27-4665-A884-FD977D2AD359}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C183991C-1F27-4665-A884-FD977D2AD359}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C183991C-1F27-4665-A884-FD977D2AD359}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C17E59D0-2D64-4012-8A98-D184D0CF8A49} = {5100FF29-2B10-4D43-822F-DEDE105433FC}
{9863D039-AB21-4710-960E-7303919552C6} = {5C328A57-B790-4B02-A36C-4EDA8280BA51}
{1705887B-E636-4FA3-AE40-2D431AF1511C} = {5C328A57-B790-4B02-A36C-4EDA8280BA51}
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306} = {5100FF29-2B10-4D43-822F-DEDE105433FC}
{F0229144-F7C4-4456-8442-5E816C6E8FBC} = {582F3F68-6C35-48E6-BC68-139AE9666F64}
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D} = {582F3F68-6C35-48E6-BC68-139AE9666F64}
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9} = {3F416416-1AEE-4F13-B338-917087AF0C54}
{9B0EDB62-1E62-492D-B807-A8501EEE8400} = {3F416416-1AEE-4F13-B338-917087AF0C54}
{6194144A-F8B1-4525-829F-061DF4A5645A} = {BE299041-AFCA-44FE-8556-EEC89F85005F}
{7F600371-17AB-41F2-96AB-39C8AA2389E1} = {BE299041-AFCA-44FE-8556-EEC89F85005F}
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7} = {67586B48-76A8-4D65-A3AC-C89D7A8774E8}
{C183991C-1F27-4665-A884-FD977D2AD359} = {67586B48-76A8-4D65-A3AC-C89D7A8774E8}
EndGlobalSection
EndGlobal
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class Board : Chipset.Board
{
internal const int GPIO_PORT_SHIFT = 12;
//
// Serial Ports
//
private static readonly string[] m_serialPorts = { "UART0", "UART1", "UART3" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART0 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PTC14,
RxPin = (int)PinName.PTC15,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART3 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PTC17,
RxPin = (int)PinName.PTC16,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)K64F.PinName.LED1,
(int)K64F.PinName.LED2,
(int)K64F.PinName.LED3,
(int)K64F.PinName.LED4,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)K64F.PinName.D3,
};
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 160;
}
}
public override int PinToIndex( int pin )
{
int port = pin >> Board.GPIO_PORT_SHIFT;
int portIndex = pin & 0x000000FF;
return ( port * 32 ) + portIndex;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Port
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART0":
return UART0;
case "UART1":
return UART1;
case "UART3":
return UART3;
default:
return null;
}
}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.PIT3_IRQn;
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART0":
return (int)IRQn.UART0_RX_TX_IRQn;
case "UART1":
return (int)IRQn.UART1_RX_TX_IRQn;
case "UART3":
return (int)IRQn.UART3_RX_TX_IRQn;
default:
throw new NotSupportedException();
}
}
//////public override void RemapSerialPortInterrupts( )
//////{
////// Processor.RemapInterrupt( IRQn.UART0_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART0_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART1_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART1_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART3_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART3_ERR_IRQn );
//////}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using RT = Microsoft.Zelig.Runtime;
public sealed class Device : Microsoft.CortexM4OnMBED.Device
{
[RT.MemoryUsage(RT.MemoryUsage.Stack, ContentsUninitialized = true, AllocateFromHighAddress = true)]
static readonly uint[] s_bootstrapStackK64F = new uint[ 1024 / sizeof( uint ) ];
//
// Access Methods
//
public override uint[] BootstrapStack
{
get
{
return s_bootstrapStackK64F;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.K64F.Drivers
{
using System.Runtime.CompilerServices;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.DeviceModels.Chipset.CortexM3.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
protected override uint GetTicksForQuantumValue( uint ms )
{
// K64F uses the Core clock (120Mhz) for SysTick
return (uint)( RT.Configuration.CoreClockFrequency / 1000 ) * ms;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
//--//
public enum PinName : uint
{
// Commented out pins do not appear to be used on the board
PTA0 = ((0 << Board.GPIO_PORT_SHIFT) | 0 ),
PTA1 = ((0 << Board.GPIO_PORT_SHIFT) | 1 ),
PTA2 = ((0 << Board.GPIO_PORT_SHIFT) | 2 ),
PTA3 = ((0 << Board.GPIO_PORT_SHIFT) | 3 ),
PTA4 = ((0 << Board.GPIO_PORT_SHIFT) | 4 ),
PTA5 = ((0 << Board.GPIO_PORT_SHIFT) | 5 ),
PTA6 = ((0 << Board.GPIO_PORT_SHIFT) | 6 ),
PTA7 = ((0 << Board.GPIO_PORT_SHIFT) | 7 ),
PTA8 = ((0 << Board.GPIO_PORT_SHIFT) | 8 ),
PTA9 = ((0 << Board.GPIO_PORT_SHIFT) | 9 ),
PTA10 = ((0 << Board.GPIO_PORT_SHIFT) | 10),
PTA11 = ((0 << Board.GPIO_PORT_SHIFT) | 11),
PTA12 = ((0 << Board.GPIO_PORT_SHIFT) | 12),
PTA13 = ((0 << Board.GPIO_PORT_SHIFT) | 13),
PTA14 = ((0 << Board.GPIO_PORT_SHIFT) | 14),
PTA15 = ((0 << Board.GPIO_PORT_SHIFT) | 15),
PTA16 = ((0 << Board.GPIO_PORT_SHIFT) | 16),
PTA17 = ((0 << Board.GPIO_PORT_SHIFT) | 17),
PTA18 = ((0 << Board.GPIO_PORT_SHIFT) | 18),
PTA19 = ((0 << Board.GPIO_PORT_SHIFT) | 19),
PTA20 = ((0 << Board.GPIO_PORT_SHIFT) | 20),
PTA21 = ((0 << Board.GPIO_PORT_SHIFT) | 21),
PTA22 = ((0 << Board.GPIO_PORT_SHIFT) | 22),
PTA23 = ((0 << Board.GPIO_PORT_SHIFT) | 23),
PTA24 = ((0 << Board.GPIO_PORT_SHIFT) | 24),
PTA25 = ((0 << Board.GPIO_PORT_SHIFT) | 25),
PTA26 = ((0 << Board.GPIO_PORT_SHIFT) | 26),
PTA27 = ((0 << Board.GPIO_PORT_SHIFT) | 27),
PTA28 = ((0 << Board.GPIO_PORT_SHIFT) | 28),
PTA29 = ((0 << Board.GPIO_PORT_SHIFT) | 29),
PTA30 = ((0 << Board.GPIO_PORT_SHIFT) | 30),
PTA31 = ((0 << Board.GPIO_PORT_SHIFT) | 31),
PTB0 = ((1 << Board.GPIO_PORT_SHIFT) | 0 ),
PTB1 = ((1 << Board.GPIO_PORT_SHIFT) | 1 ),
PTB2 = ((1 << Board.GPIO_PORT_SHIFT) | 2 ),
PTB3 = ((1 << Board.GPIO_PORT_SHIFT) | 3 ),
PTB4 = ((1 << Board.GPIO_PORT_SHIFT) | 4 ),
PTB5 = ((1 << Board.GPIO_PORT_SHIFT) | 5 ),
PTB6 = ((1 << Board.GPIO_PORT_SHIFT) | 6 ),
PTB7 = ((1 << Board.GPIO_PORT_SHIFT) | 7 ),
PTB8 = ((1 << Board.GPIO_PORT_SHIFT) | 8 ),
PTB9 = ((1 << Board.GPIO_PORT_SHIFT) | 9 ),
PTB10 = ((1 << Board.GPIO_PORT_SHIFT) | 10),
PTB11 = ((1 << Board.GPIO_PORT_SHIFT) | 11),
PTB12 = ((1 << Board.GPIO_PORT_SHIFT) | 12),
PTB13 = ((1 << Board.GPIO_PORT_SHIFT) | 13),
PTB14 = ((1 << Board.GPIO_PORT_SHIFT) | 14),
PTB15 = ((1 << Board.GPIO_PORT_SHIFT) | 15),
PTB16 = ((1 << Board.GPIO_PORT_SHIFT) | 16),
PTB17 = ((1 << Board.GPIO_PORT_SHIFT) | 17),
PTB18 = ((1 << Board.GPIO_PORT_SHIFT) | 18),
PTB19 = ((1 << Board.GPIO_PORT_SHIFT) | 19),
PTB20 = ((1 << Board.GPIO_PORT_SHIFT) | 20),
PTB21 = ((1 << Board.GPIO_PORT_SHIFT) | 21),
PTB22 = ((1 << Board.GPIO_PORT_SHIFT) | 22),
PTB23 = ((1 << Board.GPIO_PORT_SHIFT) | 23),
PTB24 = ((1 << Board.GPIO_PORT_SHIFT) | 24),
PTB25 = ((1 << Board.GPIO_PORT_SHIFT) | 25),
PTB26 = ((1 << Board.GPIO_PORT_SHIFT) | 26),
PTB27 = ((1 << Board.GPIO_PORT_SHIFT) | 27),
PTB28 = ((1 << Board.GPIO_PORT_SHIFT) | 28),
PTB29 = ((1 << Board.GPIO_PORT_SHIFT) | 29),
PTB30 = ((1 << Board.GPIO_PORT_SHIFT) | 30),
PTB31 = ((1 << Board.GPIO_PORT_SHIFT) | 31),
PTC0 = ((2 << Board.GPIO_PORT_SHIFT) | 0 ),
PTC1 = ((2 << Board.GPIO_PORT_SHIFT) | 1 ),
PTC2 = ((2 << Board.GPIO_PORT_SHIFT) | 2 ),
PTC3 = ((2 << Board.GPIO_PORT_SHIFT) | 3 ),
PTC4 = ((2 << Board.GPIO_PORT_SHIFT) | 4 ),
PTC5 = ((2 << Board.GPIO_PORT_SHIFT) | 5 ),
PTC6 = ((2 << Board.GPIO_PORT_SHIFT) | 6 ),
PTC7 = ((2 << Board.GPIO_PORT_SHIFT) | 7 ),
PTC8 = ((2 << Board.GPIO_PORT_SHIFT) | 8 ),
PTC9 = ((2 << Board.GPIO_PORT_SHIFT) | 9 ),
PTC10 = ((2 << Board.GPIO_PORT_SHIFT) | 10),
PTC11 = ((2 << Board.GPIO_PORT_SHIFT) | 11),
PTC12 = ((2 << Board.GPIO_PORT_SHIFT) | 12),
PTC13 = ((2 << Board.GPIO_PORT_SHIFT) | 13),
PTC14 = ((2 << Board.GPIO_PORT_SHIFT) | 14),
PTC15 = ((2 << Board.GPIO_PORT_SHIFT) | 15),
PTC16 = ((2 << Board.GPIO_PORT_SHIFT) | 16),
PTC17 = ((2 << Board.GPIO_PORT_SHIFT) | 17),
PTC18 = ((2 << Board.GPIO_PORT_SHIFT) | 18),
PTC19 = ((2 << Board.GPIO_PORT_SHIFT) | 19),
PTC20 = ((2 << Board.GPIO_PORT_SHIFT) | 20),
PTC21 = ((2 << Board.GPIO_PORT_SHIFT) | 21),
PTC22 = ((2 << Board.GPIO_PORT_SHIFT) | 22),
PTC23 = ((2 << Board.GPIO_PORT_SHIFT) | 23),
PTC24 = ((2 << Board.GPIO_PORT_SHIFT) | 24),
PTC25 = ((2 << Board.GPIO_PORT_SHIFT) | 25),
PTC26 = ((2 << Board.GPIO_PORT_SHIFT) | 26),
PTC27 = ((2 << Board.GPIO_PORT_SHIFT) | 27),
PTC28 = ((2 << Board.GPIO_PORT_SHIFT) | 28),
PTC29 = ((2 << Board.GPIO_PORT_SHIFT) | 29),
PTC30 = ((2 << Board.GPIO_PORT_SHIFT) | 30),
PTC31 = ((2 << Board.GPIO_PORT_SHIFT) | 31),
PTD0 = ((3 << Board.GPIO_PORT_SHIFT) | 0 ),
PTD1 = ((3 << Board.GPIO_PORT_SHIFT) | 1 ),
PTD2 = ((3 << Board.GPIO_PORT_SHIFT) | 2 ),
PTD3 = ((3 << Board.GPIO_PORT_SHIFT) | 3 ),
PTD4 = ((3 << Board.GPIO_PORT_SHIFT) | 4 ),
PTD5 = ((3 << Board.GPIO_PORT_SHIFT) | 5 ),
PTD6 = ((3 << Board.GPIO_PORT_SHIFT) | 6 ),
PTD7 = ((3 << Board.GPIO_PORT_SHIFT) | 7 ),
PTD8 = ((3 << Board.GPIO_PORT_SHIFT) | 8 ),
PTD9 = ((3 << Board.GPIO_PORT_SHIFT) | 9 ),
PTD10 = ((3 << Board.GPIO_PORT_SHIFT) | 10),
PTD11 = ((3 << Board.GPIO_PORT_SHIFT) | 11),
PTD12 = ((3 << Board.GPIO_PORT_SHIFT) | 12),
PTD13 = ((3 << Board.GPIO_PORT_SHIFT) | 13),
PTD14 = ((3 << Board.GPIO_PORT_SHIFT) | 14),
PTD15 = ((3 << Board.GPIO_PORT_SHIFT) | 15),
PTD16 = ((3 << Board.GPIO_PORT_SHIFT) | 16),
PTD17 = ((3 << Board.GPIO_PORT_SHIFT) | 17),
PTD18 = ((3 << Board.GPIO_PORT_SHIFT) | 18),
PTD19 = ((3 << Board.GPIO_PORT_SHIFT) | 19),
PTD20 = ((3 << Board.GPIO_PORT_SHIFT) | 20),
PTD21 = ((3 << Board.GPIO_PORT_SHIFT) | 21),
PTD22 = ((3 << Board.GPIO_PORT_SHIFT) | 22),
PTD23 = ((3 << Board.GPIO_PORT_SHIFT) | 23),
PTD24 = ((3 << Board.GPIO_PORT_SHIFT) | 24),
PTD25 = ((3 << Board.GPIO_PORT_SHIFT) | 25),
PTD26 = ((3 << Board.GPIO_PORT_SHIFT) | 26),
PTD27 = ((3 << Board.GPIO_PORT_SHIFT) | 27),
PTD28 = ((3 << Board.GPIO_PORT_SHIFT) | 28),
PTD29 = ((3 << Board.GPIO_PORT_SHIFT) | 29),
PTD30 = ((3 << Board.GPIO_PORT_SHIFT) | 30),
PTD31 = ((3 << Board.GPIO_PORT_SHIFT) | 31),
PTE0 = ((4 << Board.GPIO_PORT_SHIFT) | 0 ),
PTE1 = ((4 << Board.GPIO_PORT_SHIFT) | 1 ),
PTE2 = ((4 << Board.GPIO_PORT_SHIFT) | 2 ),
PTE3 = ((4 << Board.GPIO_PORT_SHIFT) | 3 ),
PTE4 = ((4 << Board.GPIO_PORT_SHIFT) | 4 ),
PTE5 = ((4 << Board.GPIO_PORT_SHIFT) | 5 ),
PTE6 = ((4 << Board.GPIO_PORT_SHIFT) | 6 ),
PTE7 = ((4 << Board.GPIO_PORT_SHIFT) | 7 ),
PTE8 = ((4 << Board.GPIO_PORT_SHIFT) | 8 ),
PTE9 = ((4 << Board.GPIO_PORT_SHIFT) | 9 ),
PTE10 = ((4 << Board.GPIO_PORT_SHIFT) | 10),
PTE11 = ((4 << Board.GPIO_PORT_SHIFT) | 11),
PTE12 = ((4 << Board.GPIO_PORT_SHIFT) | 12),
PTE13 = ((4 << Board.GPIO_PORT_SHIFT) | 13),
PTE14 = ((4 << Board.GPIO_PORT_SHIFT) | 14),
PTE15 = ((4 << Board.GPIO_PORT_SHIFT) | 15),
PTE16 = ((4 << Board.GPIO_PORT_SHIFT) | 16),
PTE17 = ((4 << Board.GPIO_PORT_SHIFT) | 17),
PTE18 = ((4 << Board.GPIO_PORT_SHIFT) | 18),
PTE19 = ((4 << Board.GPIO_PORT_SHIFT) | 19),
PTE20 = ((4 << Board.GPIO_PORT_SHIFT) | 20),
PTE21 = ((4 << Board.GPIO_PORT_SHIFT) | 21),
PTE22 = ((4 << Board.GPIO_PORT_SHIFT) | 22),
PTE23 = ((4 << Board.GPIO_PORT_SHIFT) | 23),
PTE24 = ((4 << Board.GPIO_PORT_SHIFT) | 24),
PTE25 = ((4 << Board.GPIO_PORT_SHIFT) | 25),
PTE26 = ((4 << Board.GPIO_PORT_SHIFT) | 26),
PTE27 = ((4 << Board.GPIO_PORT_SHIFT) | 27),
PTE28 = ((4 << Board.GPIO_PORT_SHIFT) | 28),
PTE29 = ((4 << Board.GPIO_PORT_SHIFT) | 29),
PTE30 = ((4 << Board.GPIO_PORT_SHIFT) | 30),
PTE31 = ((4 << Board.GPIO_PORT_SHIFT) | 31),
LED_RED = PTB22,
LED_GREEN = PTE26,
LED_BLUE = PTB21,
// mbed original LED naming
LED1 = LED_RED,
LED2 = LED_GREEN,
LED3 = LED_BLUE,
LED4 = LED_RED,
//Push buttons
SW2 = PTC6,
SW3 = PTA4,
// USB Pins
USBTX = PTB17,
USBRX = PTB16,
// Arduino Headers
D0 = PTC16,
D1 = PTC17,
D2 = PTB9,
D3 = PTA1,
D4 = PTB23,
D5 = PTA2,
D6 = PTC2,
D7 = PTC3,
D8 = PTA0,
D9 = PTC4,
D10 = PTD0,
D11 = PTD2,
D12 = PTD3,
D13 = PTD1,
D14 = PTE25,
D15 = PTE24,
I2C_SCL = D15,
I2C_SDA = D14,
A0 = PTB2,
A1 = PTB3,
A2 = PTB10,
A3 = PTB11,
A4 = PTC11,
A5 = PTC10,
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
// Not connected
NC = 0xFFFFFFFF
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F.HardwareModel.HardwareProviders
{
using System;
using Chipset = CortexM4OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
//////public override void RemapInterrupts()
//////{
////// Processor.RemapInterrupt( IRQn.PORTA_IRQn );
////// Processor.RemapInterrupt( IRQn.PORTB_IRQn );
////// Processor.RemapInterrupt( IRQn.PORTC_IRQn );
////// Processor.RemapInterrupt( IRQn.PORTD_IRQn );
////// Processor.RemapInterrupt( IRQn.PORTE_IRQn );
//////}
public override int GetGpioPinIRQNumber(int pinNumber)
{
PinName pin = (PinName)pinNumber;
if (PinName.PTA0 <= pin && pin < PinName.PTB0)
{
return (int)IRQn.PORTA_IRQn;
}
else if (PinName.PTB0 <= pin && pin < PinName.PTC0)
{
return (int)IRQn.PORTB_IRQn;
}
else if (PinName.PTC0 <= pin && pin < PinName.PTD0)
{
return (int)IRQn.PORTC_IRQn;
}
else if (PinName.PTD0 <= pin && pin < PinName.PTE0)
{
return (int)IRQn.PORTD_IRQn;
}
else if (PinName.PTE0 <= pin && pin <= PinName.PTE31)
{
return (int)IRQn.PORTB_IRQn;
}
throw new NotSupportedException();
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SclPin = (int)PinName.I2C_SCL,
SdaPin = (int)PinName.I2C_SDA,
PortIndex = 0,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProviders/NetworkInterfaceProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED.HardwareModel;
public sealed class NetworkInterfaceProvider : Chipset.NetworkInterfaceProvider
{
public override void RemapInterrupts()
{
Processor.RemapInterrupt( IRQn.ENET_Receive_IRQn );
Processor.RemapInterrupt( IRQn.ENET_Transmit_IRQn );
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.PTD2,
Miso = unchecked((int)PinName.NC),
Sclk = (int)PinName.PTD1,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.PTD6,
Miso = (int)PinName.PTD7,
Sclk = (int)PinName.PTD5,
DefaultChipSelect = (int)PinName.PTD4,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI2 = new SpiChannelInfo()
{
Mosi = (int)PinName.PTE3,
Miso = (int)PinName.PTE1,
Sclk = (int)PinName.PTE2,
DefaultChipSelect = (int)PinName.PTE4,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return false;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
case 2:
return SPI2;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class AdcProviderUwp : RT.AdcProviderUwp
{
private static readonly RT.AdcChannelInfoUwp m_adcInfo = new RT.AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] { (int)PinName.A0, (int)PinName.A1, (int)PinName.A2, (int)PinName.A3, (int)PinName.A4, (int)PinName.A5 }
};
public override RT.AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.A4,
(int)PinName.A5,
(int)PinName.D3,
(int)PinName.D4,
(int)PinName.D5,
(int)PinName.D6,
(int)PinName.D7,
(int)PinName.D8,
(int)PinName.D9,
(int)PinName.D10,
(int)PinName.D11,
(int)PinName.D12,
(int)PinName.D13,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
private static readonly string[] m_spiDevices = { "SPI0", "SPI1", "SPI2" };
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public static readonly SpiChannelInfoUwp SPI2 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI2,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI0":
return SPI0;
case "SPI1":
return SPI1;
case "SPI2":
return SPI2;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
enum IRQn
{
/* Core interrupts */
NonMaskableInt_IRQn = -14, /**< Non Maskable Interrupt */
HardFault_IRQn = -13, /**< Cortex-M4 SV Hard Fault Interrupt */
MemoryManagement_IRQn = -12, /**< Cortex-M4 Memory Management Interrupt */
BusFault_IRQn = -11, /**< Cortex-M4 Bus Fault Interrupt */
UsageFault_IRQn = -10, /**< Cortex-M4 Usage Fault Interrupt */
SVCall_IRQn = -5, /**< Cortex-M4 SV Call Interrupt */
DebugMonitor_IRQn = -4, /**< Cortex-M4 Debug Monitor Interrupt */
PendSV_IRQn = -2, /**< Cortex-M4 Pend SV Interrupt */
SysTick_IRQn = -1, /**< Cortex-M4 System Tick Interrupt */
/* Device specific interrupts */
DMA0_IRQn = 0, /**< DMA Channel 0 Transfer Complete */
DMA1_IRQn = 1, /**< DMA Channel 1 Transfer Complete */
DMA2_IRQn = 2, /**< DMA Channel 2 Transfer Complete */
DMA3_IRQn = 3, /**< DMA Channel 3 Transfer Complete */
DMA4_IRQn = 4, /**< DMA Channel 4 Transfer Complete */
DMA5_IRQn = 5, /**< DMA Channel 5 Transfer Complete */
DMA6_IRQn = 6, /**< DMA Channel 6 Transfer Complete */
DMA7_IRQn = 7, /**< DMA Channel 7 Transfer Complete */
DMA8_IRQn = 8, /**< DMA Channel 8 Transfer Complete */
DMA9_IRQn = 9, /**< DMA Channel 9 Transfer Complete */
DMA10_IRQn = 10, /**< DMA Channel 10 Transfer Complete */
DMA11_IRQn = 11, /**< DMA Channel 11 Transfer Complete */
DMA12_IRQn = 12, /**< DMA Channel 12 Transfer Complete */
DMA13_IRQn = 13, /**< DMA Channel 13 Transfer Complete */
DMA14_IRQn = 14, /**< DMA Channel 14 Transfer Complete */
DMA15_IRQn = 15, /**< DMA Channel 15 Transfer Complete */
DMA_Error_IRQn = 16, /**< DMA Error Interrupt */
MCM_IRQn = 17, /**< Normal Interrupt */
FTFE_IRQn = 18, /**< FTFE Command complete interrupt */
Read_Collision_IRQn = 19, /**< Read Collision Interrupt */
LVD_LVW_IRQn = 20, /**< Low Voltage Detect, Low Voltage Warning */
LLW_IRQn = 21, /**< Low Leakage Wakeup */
Watchdog_IRQn = 22, /**< WDOG Interrupt */
RNG_IRQn = 23, /**< RNG Interrupt */
I2C0_IRQn = 24, /**< I2C0 interrupt */
I2C1_IRQn = 25, /**< I2C1 interrupt */
SPI0_IRQn = 26, /**< SPI0 Interrupt */
SPI1_IRQn = 27, /**< SPI1 Interrupt */
I2S0_Tx_IRQn = 28, /**< I2S0 transmit interrupt */
I2S0_Rx_IRQn = 29, /**< I2S0 receive interrupt */
UART0_LON_IRQn = 30, /**< UART0 LON interrupt */
UART0_RX_TX_IRQn = 31, /**< UART0 Receive/Transmit interrupt */
UART0_ERR_IRQn = 32, /**< UART0 Error interrupt */
UART1_RX_TX_IRQn = 33, /**< UART1 Receive/Transmit interrupt */
UART1_ERR_IRQn = 34, /**< UART1 Error interrupt */
UART2_RX_TX_IRQn = 35, /**< UART2 Receive/Transmit interrupt */
UART2_ERR_IRQn = 36, /**< UART2 Error interrupt */
UART3_RX_TX_IRQn = 37, /**< UART3 Receive/Transmit interrupt */
UART3_ERR_IRQn = 38, /**< UART3 Error interrupt */
ADC0_IRQn = 39, /**< ADC0 interrupt */
CMP0_IRQn = 40, /**< CMP0 interrupt */
CMP1_IRQn = 41, /**< CMP1 interrupt */
FTM0_IRQn = 42, /**< FTM0 fault, overflow and channels interrupt */
FTM1_IRQn = 43, /**< FTM1 fault, overflow and channels interrupt */
FTM2_IRQn = 44, /**< FTM2 fault, overflow and channels interrupt */
CMT_IRQn = 45, /**< CMT interrupt */
RTC_IRQn = 46, /**< RTC interrupt */
RTC_Seconds_IRQn = 47, /**< RTC seconds interrupt */
PIT0_IRQn = 48, /**< PIT timer channel 0 interrupt */
PIT1_IRQn = 49, /**< PIT timer channel 1 interrupt */
PIT2_IRQn = 50, /**< PIT timer channel 2 interrupt */
PIT3_IRQn = 51, /**< PIT timer channel 3 interrupt */
PDB0_IRQn = 52, /**< PDB0 Interrupt */
USB0_IRQn = 53, /**< USB0 interrupt */
USBDCD_IRQn = 54, /**< USBDCD Interrupt */
Reserved71_IRQn = 55, /**< Reserved interrupt 71 */
DAC0_IRQn = 56, /**< DAC0 interrupt */
MCG_IRQn = 57, /**< MCG Interrupt */
LPTimer_IRQn = 58, /**< LPTimer interrupt */
PORTA_IRQn = 59, /**< Port A interrupt */
PORTB_IRQn = 60, /**< Port B interrupt */
PORTC_IRQn = 61, /**< Port C interrupt */
PORTD_IRQn = 62, /**< Port D interrupt */
PORTE_IRQn = 63, /**< Port E interrupt */
SWI_IRQn = 64, /**< Software interrupt */
SPI2_IRQn = 65, /**< SPI2 Interrupt */
UART4_RX_TX_IRQn = 66, /**< UART4 Receive/Transmit interrupt */
UART4_ERR_IRQn = 67, /**< UART4 Error interrupt */
UART5_RX_TX_IRQn = 68, /**< UART5 Receive/Transmit interrupt */
UART5_ERR_IRQn = 69, /**< UART5 Error interrupt */
CMP2_IRQn = 70, /**< CMP2 interrupt */
FTM3_IRQn = 71, /**< FTM3 fault, overflow and channels interrupt */
DAC1_IRQn = 72, /**< DAC1 interrupt */
ADC1_IRQn = 73, /**< ADC1 interrupt */
I2C2_IRQn = 74, /**< I2C2 interrupt */
CAN0_ORed_Message_buffer_IRQn = 75, /**< CAN0 OR'd message buffers interrupt */
CAN0_Bus_Off_IRQn = 76, /**< CAN0 bus off interrupt */
CAN0_Error_IRQn = 77, /**< CAN0 error interrupt */
CAN0_Tx_Warning_IRQn = 78, /**< CAN0 Tx warning interrupt */
CAN0_Rx_Warning_IRQn = 79, /**< CAN0 Rx warning interrupt */
CAN0_Wake_Up_IRQn = 80, /**< CAN0 wake up interrupt */
SDHC_IRQn = 81, /**< SDHC interrupt */
ENET_1588_Timer_IRQn = 82, /**< Ethernet MAC IEEE 1588 Timer Interrupt */
ENET_Transmit_IRQn = 83, /**< Ethernet MAC Transmit Interrupt */
ENET_Receive_IRQn = 84, /**< Ethernet MAC Receive Interrupt */
ENET_Error_IRQn = 85, /**< Ethernet MAC Error and miscelaneous Interrupt */
LAST = 86,
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ALLOW_PAUSE
namespace Microsoft.Llilum.K64F
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/HardwareModel/Processor.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using System;
using System.Runtime.InteropServices;
using RT = Microsoft.Zelig.Runtime;
using ARMv7 = Microsoft.Zelig.Runtime.TargetPlatform.ARMv7;
using ChipsetModel = Microsoft.CortexM4OnMBED;
[RT.ProductFilter( "Microsoft.Llilum.BoardConfigurations.K64FMBED" )]
public sealed class Processor : Microsoft.CortexM4OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
{
public Context( RT.ThreadImpl owner ) : base( owner )
{
}
public override unsafe void SwitchTo( )
{
//
// BUGBUG: return to thread using VFP state as well
//
base.SwitchTo( );
}
}
internal static void RemapInterrupt( IRQn irqNumber )
{
var processor = (Microsoft.Llilum.K64F.Processor)Processor.Instance;
using(RT.SmartHandles.InterruptState.Disable( ))
{
switch(irqNumber)
{
////////
//////// UART
////////
//////case IRQn.UART0_ERR_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART0_ERR_IRQn, Zelig_Exception_UART0_ERR_IRQHandler );
////// break;
//////case IRQn.UART0_RX_TX_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART0_RX_TX_IRQn, Zelig_Exception_UART0_RX_TX_IRQHandler );
////// break;
//////case IRQn.UART1_ERR_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART1_ERR_IRQn, Zelig_Exception_UART1_ERR_IRQHandler );
////// break;
//////case IRQn.UART1_RX_TX_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART1_RX_TX_IRQn, Zelig_Exception_UART1_RX_TX_IRQHandler );
////// break;
//////case IRQn.UART3_ERR_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART3_ERR_IRQn, Zelig_Exception_UART3_ERR_IRQHandler );
////// break;
//////case IRQn.UART3_RX_TX_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.UART3_RX_TX_IRQn, Zelig_Exception_UART3_RX_TX_IRQHandler );
////// break;
////////
//////// GPIO
////////
//////case IRQn.PORTA_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.PORTA_IRQn, Zelig_Exception_PORTA_IRQHandler );
////// break;
//////case IRQn.PORTB_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.PORTB_IRQn, Zelig_Exception_PORTB_IRQHandler );
////// break;
//////case IRQn.PORTC_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.PORTC_IRQn, Zelig_Exception_PORTC_IRQHandler );
////// break;
//////case IRQn.PORTD_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.PORTD_IRQn, Zelig_Exception_PORTD_IRQHandler );
////// break;
//////case IRQn.PORTE_IRQn:
////// processor.RemapInterrupt( (IRQn_Type)IRQn.PORTE_IRQn, Zelig_Exception_PORTE_IRQHandler );
////// break;
//
// Ethernet
//
case IRQn.ENET_Receive_IRQn:
processor.RemapInterrupt( (IRQn_Type)IRQn.ENET_Receive_IRQn, Zelig_Exception_ENET_Receive_IRQHandler );
break;
case IRQn.ENET_Transmit_IRQn:
processor.RemapInterrupt( (IRQn_Type)IRQn.ENET_Transmit_IRQn, Zelig_Exception_ENET_Transmit_IRQHandler );
break;
default:
RT.BugCheck.Assert( false, Zelig.Runtime.BugCheck.StopCode.IncorrectArgument );
break;
}
}
}
//--//
//
// State
//
private static readonly Action s_ENET_Receive_IRQHandler;
private static readonly Action s_ENET_Transmit_IRQHandler;
//////private static readonly Action s_UART0_RX_TX_IRQHandler;
//////private static readonly Action s_UART0_ERR_IRQHandler;
//////private static readonly Action s_UART1_RX_TX_IRQHandler;
//////private static readonly Action s_UART1_ERR_IRQHandler;
//////private static readonly Action s_UART3_RX_TX_IRQHandler;
//////private static readonly Action s_UART3_ERR_IRQHandler;
//////private static readonly Action s_PORTA_IRQHandler;
//////private static readonly Action s_PORTB_IRQHandler;
//////private static readonly Action s_PORTC_IRQHandler;
//////private static readonly Action s_PORTD_IRQHandler;
//////private static readonly Action s_PORTE_IRQHandler;
//--//
//
// Constructors
//
static Processor( )
{
s_ENET_Transmit_IRQHandler = new Action( ENET_Transmit_IRQHandler_Wrapper );
s_ENET_Receive_IRQHandler = new Action( ENET_Receive_IRQHandler_Wrapper );
//////s_UART0_RX_TX_IRQHandler = new Action( UART0_RX_TX_IRQHandler );
//////s_UART0_ERR_IRQHandler = new Action( UART0_ERR_IRQHandler );
//////s_UART1_RX_TX_IRQHandler = new Action( UART1_RX_TX_IRQHandler );
//////s_UART1_ERR_IRQHandler = new Action( UART1_ERR_IRQHandler );
//////s_UART3_RX_TX_IRQHandler = new Action( UART3_RX_TX_IRQHandler );
//////s_UART3_ERR_IRQHandler = new Action( UART3_ERR_IRQHandler );
//////s_PORTA_IRQHandler = new Action( PORTA_IRQHandler );
//////s_PORTB_IRQHandler = new Action( PORTB_IRQHandler );
//////s_PORTC_IRQHandler = new Action( PORTC_IRQHandler );
//////s_PORTD_IRQHandler = new Action( PORTD_IRQHandler );
//////s_PORTE_IRQHandler = new Action( PORTE_IRQHandler );
}
//
// Helper methods
//
[RT.Inline]
public override void InitializeProcessor( )
{
base.InitializeProcessor( );
DisableMPU( );
}
[RT.Inline]
public override Microsoft.Zelig.Runtime.Processor.Context AllocateProcessorContext( RT.ThreadImpl owner )
{
return new Context( owner );
}
//--//
private unsafe void DisableMPU( )
{
CUSTOM_STUB_K64F_DisableMPU( );
}
[DllImport( "C" )]
private static extern void CUSTOM_STUB_K64F_DisableMPU( );
//--//
//--//
//--//
#region Warapper for exception handlers
//
// UART
//
private static void UART0_RX_TX_IRQHandler_Wrapper( )
{
UART0_RX_TX_IRQHandler( );
}
private static void UART0_ERR_IRQHandler_Wrapper( )
{
UART0_ERR_IRQHandler( );
}
private static void UART1_RX_TX_IRQHandler_Wrapper( )
{
UART1_RX_TX_IRQHandler( );
}
private static void UART1_ERR_IRQHandler_Wrapper( )
{
UART1_ERR_IRQHandler( );
}
private static void UART3_RX_TX_IRQHandler_Wrapper( )
{
UART3_RX_TX_IRQHandler( );
}
private static void UART3_ERR_IRQHandler_Wrapper( )
{
UART3_ERR_IRQHandler( );
}
//
// GPIO
//
private static void PORTA_IRQHandler_Wrapper( )
{
PORTA_IRQHandler( );
}
private static void PORTB_IRQHandler_Wrapper( )
{
PORTB_IRQHandler( );
}
private static void PORTC_IRQHandler_Wrapper( )
{
PORTC_IRQHandler( );
}
private static void PORTD_IRQHandler_Wrapper( )
{
PORTD_IRQHandler( );
}
private static void PORTE_IRQHandler_Wrapper( )
{
PORTE_IRQHandler( );
}
//
// Ethernet
//
private static void ENET_Transmit_IRQHandler_Wrapper( )
{
ENET_Transmit_IRQHandler( );
}
private static void ENET_Receive_IRQHandler_Wrapper( )
{
ENET_Receive_IRQHandler( );
}
#endregion
//--//
//--//
//--//
#region Exported exception handlers
//
// Export all exception handler for native platform to call
//
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA3_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA3_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA4_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA4_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA5_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA5_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA6_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA6_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA7_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA7_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA8_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA8_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA9_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA9_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA10_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA10_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA11_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA11_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA12_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA12_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA13_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA13_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA14_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA14_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA15_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA15_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DMA_Error_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DMA_Error_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_MCM_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( MCM_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_FTFE_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( FTFE_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_Read_Collision_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( Read_Collision_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_LVD_LVW_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( LVD_LVW_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_LLW_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( LLW_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_Watchdog_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( Watchdog_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_RNG_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( RNG_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_I2C0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( I2C0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_I2C1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( I2C1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_SPI0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( SPI0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_SPI1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( SPI1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_I2S0_Tx_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( I2S0_Tx_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_I2S0_Rx_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( I2S0_Rx_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler(RT.HardwareException.Interrupt)]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART0_LON_IRQHandler()
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler(UART0_LON_IRQHandler);
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART0_RX_TX_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART0_RX_TX_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART0_ERR_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART0_ERR_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART1_RX_TX_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART1_RX_TX_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////[RT.DisableNullChecks]
//////private static void Zelig_Exception_UART1_ERR_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART1_ERR_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler(RT.HardwareException.Interrupt)]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART2_RX_TX_IRQHandler()
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler(UART2_RX_TX_IRQHandler);
//////}
//////[RT.HardwareExceptionHandler(RT.HardwareException.Interrupt)]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART2_ERR_IRQHandler()
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler(UART2_ERR_IRQHandler);
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART3_RX_TX_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART3_RX_TX_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART3_ERR_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_UART3_ERR_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_ADC0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( ADC0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CMP0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CMP0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CMP1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CMP1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_FTM0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( FTM0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_FTM1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( FTM1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_FTM2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( FTM2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CMT_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CMT_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_RTC_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( RTC_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_RTC_Seconds_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( RTC_Seconds_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PIT0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( PIT0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PIT1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( PIT1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PIT2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( PIT2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler(RT.HardwareException.Interrupt)]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PIT3_IRQHandler()
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler(PIT3_IRQHandler);
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PDB0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( PDB0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_USB0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( USB0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_USBDCD_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( USBDCD_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_Reserved71_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( Reserved71_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DAC0_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DAC0_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_MCG_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( MCG_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_LPTimer_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( LPTimer_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PORTA_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_PORTA_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PORTB_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_PORTB_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PORTC_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_PORTC_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PORTD_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_PORTD_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_PORTE_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( s_PORTE_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_SWI_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( SWI_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_SPI2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( SPI2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART4_RX_TX_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( UART4_RX_TX_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART4_ERR_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( UART4_ERR_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART5_RX_TX_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( UART5_RX_TX_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_UART5_ERR_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( UART5_ERR_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CMP2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CMP2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_FTM3_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( FTM3_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_DAC1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DAC1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_ADC1_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( ADC1_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_I2C2_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( I2C2_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_ORed_Message_buffer_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_ORed_Message_buffer_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_Bus_Off_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_Bus_Off_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_Error_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_Error_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_Tx_Warning_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_Tx_Warning_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_Rx_Warning_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_Rx_Warning_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_CAN0_Wake_Up_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( CAN0_Wake_Up_IRQHandler );
//////}
//////[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//////[RT.ExportedMethod]
//////private static void Zelig_Exception_SDHC_IRQHandler( )
//////{
////// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( SDHC_IRQHandler );
//////}
//[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//[RT.ExportedMethod]
//private static void Zelig_Exception_ENET_1588_Timer_IRQHandler( )
//{
// //ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( ENET_1588_Timer_IRQHandler );
// ENET_1588_Timer_IRQHandler( );
//}
[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
[RT.ExportedMethod]
[RT.DisableNullChecks]
private static void Zelig_Exception_ENET_Transmit_IRQHandler( )
{
ARMv7.ProcessorARMv7MForLlvm.ExclusiveAccessExceptionHandler( s_ENET_Transmit_IRQHandler );
}
[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
[RT.ExportedMethod]
[RT.DisableNullChecks]
private static void Zelig_Exception_ENET_Receive_IRQHandler( )
{
ARMv7.ProcessorARMv7MForLlvm.ExclusiveAccessExceptionHandler( s_ENET_Receive_IRQHandler );
}
//[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//[RT.ExportedMethod]
//private static void Zelig_Exception_ENET_Error_IRQHandler( )
//{
// //ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( ENET_Error_IRQHandler );
// ENET_Error_IRQHandler( );
//}
//[RT.HardwareExceptionHandler( RT.HardwareException.Interrupt )]
//[RT.ExportedMethod]
//private static void Zelig_Exception_DefaultISR( )
//{
// ARMv7.ProcessorARMv7M.ExclusiveAccessExceptionHandler( DefaultISR );
//}
#endregion
//--//
//--//
//--//
#region Imported exception handlers
//
// Import all exception handler from native platform
//
[DllImport( "C" )]
private static extern void NMI_Handler( );
[DllImport( "C" )]
private static extern void HardFault_Handler( );
[DllImport( "C" )]
private static extern void MemManage_Handler( );
[DllImport( "C" )]
private static extern void BusFault_Handler( );
[DllImport( "C" )]
private static extern void UsageFault_Handler( );
[DllImport( "C" )]
private static extern void SVC_Handler( );
[DllImport( "C" )]
private static extern void DebugMon_Handler( );
[DllImport( "C" )]
private static extern void PendSV_Handler( );
[DllImport( "C" )]
private static extern void SysTick_Handler( );
[DllImport( "C" )]
private static extern void DMA0_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA1_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA2_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA3_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA4_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA5_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA6_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA7_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA8_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA9_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA10_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA11_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA12_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA13_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA14_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA15_IRQHandler( );
[DllImport( "C" )]
private static extern void DMA_Error_IRQHandler( );
[DllImport( "C" )]
private static extern void MCM_IRQHandler( );
[DllImport( "C" )]
private static extern void FTFE_IRQHandler( );
[DllImport( "C" )]
private static extern void Read_Collision_IRQHandler( );
[DllImport( "C" )]
private static extern void LVD_LVW_IRQHandler( );
[DllImport( "C" )]
private static extern void LLW_IRQHandler( );
[DllImport( "C" )]
private static extern void Watchdog_IRQHandler( );
[DllImport( "C" )]
private static extern void RNG_IRQHandler( );
[DllImport( "C" )]
private static extern void I2C0_IRQHandler( );
[DllImport( "C" )]
private static extern void I2C1_IRQHandler( );
[DllImport( "C" )]
private static extern void SPI0_IRQHandler( );
[DllImport( "C" )]
private static extern void SPI1_IRQHandler( );
[DllImport( "C" )]
private static extern void I2S0_Tx_IRQHandler( );
[DllImport( "C" )]
private static extern void I2S0_Rx_IRQHandler( );
[DllImport( "C" )]
private static extern void UART0_LON_IRQHandler( );
[DllImport( "C" )]
private static extern void UART0_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART0_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void UART1_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART1_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void UART2_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART2_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void UART3_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART3_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void ADC0_IRQHandler( );
[DllImport( "C" )]
private static extern void CMP0_IRQHandler( );
[DllImport( "C" )]
private static extern void CMP1_IRQHandler( );
[DllImport( "C" )]
private static extern void FTM0_IRQHandler( );
[DllImport( "C" )]
private static extern void FTM1_IRQHandler( );
[DllImport( "C" )]
private static extern void FTM2_IRQHandler( );
[DllImport( "C" )]
private static extern void CMT_IRQHandler( );
[DllImport( "C" )]
private static extern void RTC_IRQHandler( );
[DllImport( "C" )]
private static extern void RTC_Seconds_IRQHandler( );
[DllImport( "C" )]
private static extern void PIT0_IRQHandler( );
[DllImport( "C" )]
private static extern void PIT1_IRQHandler( );
[DllImport( "C" )]
private static extern void PIT2_IRQHandler( );
[DllImport( "C" )]
private static extern void PIT3_IRQHandler( );
[DllImport( "C" )]
private static extern void PDB0_IRQHandler( );
[DllImport( "C" )]
private static extern void USB0_IRQHandler( );
[DllImport( "C" )]
private static extern void USBDCD_IRQHandler( );
[DllImport( "C" )]
private static extern void Reserved71_IRQHandler( );
[DllImport( "C" )]
private static extern void DAC0_IRQHandler( );
[DllImport( "C" )]
private static extern void MCG_IRQHandler( );
[DllImport( "C" )]
private static extern void LPTimer_IRQHandler( );
[DllImport( "C" )]
private static extern void PORTA_IRQHandler( );
[DllImport( "C" )]
private static extern void PORTB_IRQHandler( );
[DllImport( "C" )]
private static extern void PORTC_IRQHandler( );
[DllImport( "C" )]
private static extern void PORTD_IRQHandler( );
[DllImport( "C" )]
private static extern void PORTE_IRQHandler( );
[DllImport( "C" )]
private static extern void SWI_IRQHandler( );
[DllImport( "C" )]
private static extern void SPI2_IRQHandler( );
[DllImport( "C" )]
private static extern void UART4_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART4_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void UART5_RX_TX_IRQHandler( );
[DllImport( "C" )]
private static extern void UART5_ERR_IRQHandler( );
[DllImport( "C" )]
private static extern void CMP2_IRQHandler( );
[DllImport( "C" )]
private static extern void FTM3_IRQHandler( );
[DllImport( "C" )]
private static extern void DAC1_IRQHandler( );
[DllImport( "C" )]
private static extern void ADC1_IRQHandler( );
[DllImport( "C" )]
private static extern void I2C2_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_ORed_Message_buffer_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_Bus_Off_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_Error_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_Tx_Warning_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_Rx_Warning_IRQHandler( );
[DllImport( "C" )]
private static extern void CAN0_Wake_Up_IRQHandler( );
[DllImport( "C" )]
private static extern void SDHC_IRQHandler( );
[DllImport( "C" )]
private static extern void ENET_1588_Timer_IRQHandler( );
[DllImport( "C" )]
private static extern void ENET_Transmit_IRQHandler( );
[DllImport( "C" )]
private static extern void ENET_Receive_IRQHandler( );
[DllImport( "C" )]
private static extern void ENET_Error_IRQHandler( );
[DllImport( "C" )]
private static extern void DefaultISR( );
#endregion
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/K64F.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{1705887B-E636-4FA3-AE40-2D431AF1511C}
Library
Properties
Microsoft.Llilum.K64F
K64F
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{b8fe271a-cd41-435e-8766-4db7609c1007}
CortexM0OnCMSIS-Core
{89ebdbb0-c81f-4611-b719-b385df215f8d}
CortexM0OnMBED
{0b37e5ba-4839-4ec4-9e36-a96bcbea2400}
CortexM3OnCMSIS-Core
{c3bfafad-a6c6-471d-a059-b3cb7e57a4ab}
ModelForCortexM0
{a30eb003-94f8-4a85-8da1-006f6810a7a4}
ModelForCortexM3
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{0c522c6a-0f77-4af8-ad78-5b2415c98c51}
CortexM3OnMBED
{7fb3f581-742d-4e12-a36a-be172c574ab0}
CortexM4OnCMSIS-Core
{65c8eda6-ac24-4e18-a5b5-216e0f2c3906}
CortexM4OnMBED
{ca8a6d38-528b-4faa-89b6-8fa9178de55d}
ModelForCortexM4
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM4.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("K64F")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("K64F")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1705887b-e636-4fa3-ae40-2d431af1511c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class GarbageCollectionManager : Chipset.GarbageCollectionManager
{
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using Chipset = Microsoft.CortexM4OnMBED;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class ThreadManager : Chipset.ThreadManager
{
private const int DefaultStackSizeK64F = 4 * 1024;
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
uint stackSize = LLOS.RuntimeMemory.LLOS_MEMORY_GetDefaultManagedStackSize();
if(stackSize == 0)
{
return DefaultStackSizeK64F;
}
return (int)stackSize;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.K64F
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("K64F")]
public sealed class K64FSoC : ProcessorCategory
{
[DependsOn(typeof(K64FSoC))]
[DisplayName("Internal 256KB Static RAM")]
[Defaults ( "BaseAddress" , 0x1FFF0000U )]
[Defaults ( "SizeInBytes" , 256 * 1024 )]
[Defaults ( "WordSize" , 32 )]
[Defaults ( "WaitStates" , 0 )]
[EnumDefaults( "Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
public sealed class InternalRAM256KB : RamMemoryCategory
{
}
[DependsOn( typeof( K64FSoC ) )]
[DisplayName( "Internal 512KB FLASH" )]
[Defaults( "BaseAddress", 0x00000000 )]
[Defaults( "SizeInBytes", 1024 * 1024 )]
[Defaults( "WordSize" , 32 )]
[Defaults( "WaitStates" , 0 )]
[EnumDefaults( "Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
public sealed class InternalFlash1024KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName( "Memory Map for K64F" )]
public sealed class K64FMemoryMap : MemoryMapCategory
{
[MergeEnumDefaults( "Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
[MemorySection( MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code )]
[AllowedOptions( typeof( K64FSoC.InternalRAM256KB ) )]
[Defaults( "BaseAddress", 0x1FFF0000U )]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults( "Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint )]
[MemorySection( MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation )]
[AllowedOptions( typeof( K64FSoC.InternalFlash1024KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("K64F MBED")]
public sealed class K64F : ProductCategory
{
[AllowedOptions(typeof(K64FSoC))]
[Defaults("CoreClockFrequency" , 120000000UL)]
[Defaults("RealTimeClockFrequency", 1000000UL )]
[Defaults("DefaultThreadPoolThreads", 3)]
[Defaults("DefaultTimerPoolThreads" , 2)]
public K64FSoC Processor;
//--//
[AllowedOptions( typeof( K64FSoC.InternalRAM256KB ) )]
[Defaults( "BaseAddress", 0x1FFF0000U )]
public RamMemoryCategory InternalRam;
[AllowedOptions( typeof( K64FSoC.InternalFlash1024KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for K64F")]
[Defaults( "Platform", typeof( Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7M_VFP ) )]
[Defaults( "CallingConvention", typeof( Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention ) )]
[Defaults("Product", typeof(K64F))]
[Defaults("MemoryMap", typeof(K64FMemoryMap))]
public sealed class K64FMBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/K64F/Configuration/K64F.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.K64F.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K64FMBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference K64F
-Reference Microsoft.Zelig.LlilumCMSIS-RTOS
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath c:\src\llvm\llvm-3.7.0.src\build\x64\Release\bin\
================================================
FILE: Zelig/BoardConfigurations/K64F/Configuration/K64FConfiguration.csproj
================================================
Debug
AnyCPU
{9863D039-AB21-4710-960E-7303919552C6}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.K64F
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
{186F31A3-EF89-4A25-B2D5-20070702AA01}
system
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\system.dll
================================================
FILE: Zelig/BoardConfigurations/K64F/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.K64F")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.K64F")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9863d039-ab21-4710-960e-7303919552c6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class Board : Chipset.Board
{
//
// Serial Ports
//
private static readonly string[] m_serialPorts = { "UART0", "UART1" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART0 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ) ,
CtsPin = unchecked( (int)PinName.NC ) ,
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.p13 ,
RxPin = (int)PinName.p14 ,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)LPC1768.PinName.LED1,
(int)LPC1768.PinName.LED2,
(int)LPC1768.PinName.LED3,
(int)LPC1768.PinName.LED4,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)LPC1768.PinName.p21,
};
//--//
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 40;
}
}
public override int PinToIndex( int pin )
{
return pin - (int)PinName.P0_0;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Ports
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART0":
return UART0;
case "UART1":
return UART1;
default:
return null;
}
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART0":
return (int)IRQn.UART0_IRQn;
case "UART1":
return (int)IRQn.UART1_IRQn;
default:
throw new NotSupportedException();
}
}
//////public override void RemapSerialPortInterrupts( )
//////{
////// Processor.RemapInterrupt( IRQn.UART0_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART0_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART1_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART1_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART3_ERR_IRQn );
////// Processor.RemapInterrupt( IRQn.UART3_ERR_IRQn );
//////}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIMER3_IRQn;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using RT = Microsoft.Zelig.Runtime;
public sealed class Device : Microsoft.CortexM3OnMBED.Device
{
// TODO: When the compiler optimizations are complete, revisit this stack size since it is likely
// it could be reduced.
[RT.MemoryUsage(RT.MemoryUsage.Stack, ContentsUninitialized = true, AllocateFromHighAddress = true)]
static readonly uint[] s_bootstrapStackLPC1768 = new uint[ 512 / sizeof( uint ) ];
public override uint[] BootstrapStack
{
get
{
return s_bootstrapStackLPC1768;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.LPC1768.Drivers
{
using Chipset = Microsoft.DeviceModels.Chipset.CortexM3.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768.Drivers
{
using Chipset = Microsoft.CortexM3OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768.Drivers
{
using Chipset = Microsoft.CortexM3OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
//--//
public enum PinName : uint
{
P0_0 = 0x2009C000, //LPC_GPIO_BASE
P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
// mbed DIP Pin Names
p5 = P0_9,
p6 = P0_8,
p7 = P0_7,
p8 = P0_6,
p9 = P0_0,
p10 = P0_1,
p11 = P0_18,
p12 = P0_17,
p13 = P0_15,
p14 = P0_16,
p15 = P0_23,
p16 = P0_24,
p17 = P0_25,
p18 = P0_26,
p19 = P1_30,
p20 = P1_31,
p21 = P2_5,
p22 = P2_4,
p23 = P2_3,
p24 = P2_2,
p25 = P2_1,
p26 = P2_0,
p27 = P0_11,
p28 = P0_10,
p29 = P0_5,
p30 = P0_4,
LED1 = P1_18,
LED2 = P1_20,
LED3 = P1_21,
LED4 = P1_23,
USBTX = P0_2,
USBRX = P0_3,
// Arch Pro Pin Names
D0 = P4_29,
D1 = P4_28,
D2 = P0_4,
D3 = P0_5,
D4 = P2_2,
D5 = P2_3,
D6 = P2_4,
D7 = P2_5,
D8 = P0_0,
D9 = P0_1,
D10 = P0_6,
D11 = P0_9,
D12 = P0_8,
D13 = P0_7,
D14 = P0_27,
D15 = P0_28,
A0 = P0_23,
A1 = P0_24,
A2 = P0_25,
A3 = P0_26,
A4 = P1_30,
A5 = P1_31,
I2C_SCL = D15,
I2C_SDA = D14,
// Not connected
NC = 0xFFFFFFFF
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768.HardwareModel.HardwareProviders
{
using Chipset = CortexM3OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
public override int GetGpioPinIRQNumber(int pinNumber)
{
//
// All GPIO interrupts use EINT3
//
return (int)IRQn.EINT3_IRQn;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SdaPin = (int)PinName.p9,
SclPin = (int)PinName.p10,
PortIndex = 0,
};
public static readonly I2cChannelInfo I2C1 = new I2cChannelInfo()
{
SdaPin = (int)PinName.p28,
SclPin = (int)PinName.p27,
PortIndex = 1,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
case 1:
return I2C1;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.p5,
Miso = (int)PinName.p6,
Sclk = (int)PinName.p7,
DefaultChipSelect = (int)PinName.p8,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.p11,
Miso = (int)PinName.p12,
Sclk = (int)PinName.p13,
DefaultChipSelect = (int)PinName.p14,
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return true;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class AdcProviderUwp : Microsoft.Zelig.Runtime.AdcProviderUwp
{
private static readonly AdcChannelInfoUwp m_adcInfo = new AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] {(int)PinName.A0, (int)PinName.A1, (int)PinName.A2, (int)PinName.A3, (int)PinName.A4, (int)PinName.A5 }
};
public override AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0", "I2C1" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
case "I2C1":
return I2cProvider.I2C1;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.p21,
(int)PinName.p22,
(int)PinName.p23,
(int)PinName.p24,
(int)PinName.p25,
(int)PinName.p26,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
private static readonly string[] m_spiDevices = { "SPI0", "SPI1", "SPI0WriteOnly" };
public static readonly SpiChannelInfo SPI0WriteOnlyChannelInfo = new SpiChannelInfo()
{
Mosi = SpiProvider.SPI0.Mosi,
Miso = unchecked((int)PinName.NC),
Sclk = SpiProvider.SPI0.Sclk,
DefaultChipSelect = SpiProvider.SPI0.DefaultChipSelect,
SetupTime = SpiProvider.SPI0.SetupTime,
HoldTime = SpiProvider.SPI0.HoldTime,
ActiveLow = SpiProvider.SPI0.ActiveLow,
};
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI0WriteOnly = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SPI0WriteOnlyChannelInfo,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI0":
return SPI0;
case "SPI1":
return SPI1;
case "SPI0WriteOnly":
return SPI0WriteOnly;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
enum IRQn
{
/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */
SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
/****** LPC17xx Specific Interrupt Numbers *******************************************************/
WDT_IRQn = 0, /*!< Watchdog Timer Interrupt */
TIMER0_IRQn = 1, /*!< Timer0 Interrupt */
TIMER1_IRQn = 2, /*!< Timer1 Interrupt */
TIMER2_IRQn = 3, /*!< Timer2 Interrupt */
TIMER3_IRQn = 4, /*!< Timer3 Interrupt */
UART0_IRQn = 5, /*!< UART0 Interrupt */
UART1_IRQn = 6, /*!< UART1 Interrupt */
UART2_IRQn = 7, /*!< UART2 Interrupt */
UART3_IRQn = 8, /*!< UART3 Interrupt */
PWM1_IRQn = 9, /*!< PWM1 Interrupt */
I2C0_IRQn = 10, /*!< I2C0 Interrupt */
I2C1_IRQn = 11, /*!< I2C1 Interrupt */
I2C2_IRQn = 12, /*!< I2C2 Interrupt */
SPI_IRQn = 13, /*!< SPI Interrupt */
SSP0_IRQn = 14, /*!< SSP0 Interrupt */
SSP1_IRQn = 15, /*!< SSP1 Interrupt */
PLL0_IRQn = 16, /*!< PLL0 Lock (Main PLL) Interrupt */
RTC_IRQn = 17, /*!< Real Time Clock Interrupt */
EINT0_IRQn = 18, /*!< External Interrupt 0 Interrupt */
EINT1_IRQn = 19, /*!< External Interrupt 1 Interrupt */
EINT2_IRQn = 20, /*!< External Interrupt 2 Interrupt */
EINT3_IRQn = 21, /*!< External Interrupt 3 Interrupt */
ADC_IRQn = 22, /*!< A/D Converter Interrupt */
BOD_IRQn = 23, /*!< Brown-Out Detect Interrupt */
USB_IRQn = 24, /*!< USB Interrupt */
CAN_IRQn = 25, /*!< CAN Interrupt */
DMA_IRQn = 26, /*!< General Purpose DMA Interrupt */
I2S_IRQn = 27, /*!< I2S Interrupt */
ENET_IRQn = 28, /*!< Ethernet Interrupt */
RIT_IRQn = 29, /*!< Repetitive Interrupt Timer Interrupt */
MCPWM_IRQn = 30, /*!< Motor Control PWM Interrupt */
QEI_IRQn = 31, /*!< Quadrature Encoder Interface Interrupt */
PLL1_IRQn = 32, /*!< PLL1 Lock (USB PLL) Interrupt */
USBActivity_IRQn = 33, /* USB Activity interrupt */
CANActivity_IRQn = 34, /* CAN Activity interrupt */
LAST = 35,
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/HardwareModel/Processor.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using RT = Microsoft.Zelig.Runtime;
using ChipsetModel = Microsoft.CortexM3OnMBED;
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.LPC1768")]
public sealed class Processor : Microsoft.CortexM3OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
{
public Context(RT.ThreadImpl owner) : base(owner)
{
}
}
//
// Helper methods
//
[RT.Inline]
public override RT.Processor.Context AllocateProcessorContext(RT.ThreadImpl owner)
{
return new Context(owner);
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/LPC1768.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{CEE4D575-4B4B-42B0-B2F1-CC7198CB7306}
Library
Properties
Microsoft.Llilum.LPC1768
LPC1768
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{b8fe271a-cd41-435e-8766-4db7609c1007}
CortexM0OnCMSIS-Core
{89ebdbb0-c81f-4611-b719-b385df215f8d}
CortexM0OnMBED
{c3bfafad-a6c6-471d-a059-b3cb7e57a4ab}
ModelForCortexM0
{a30eb003-94f8-4a85-8da1-006f6810a7a4}
ModelForCortexM3
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{0b37e5ba-4839-4ec4-9e36-a96bcbea2400}
CortexM3OnCMSIS-Core
{0c522c6a-0f77-4af8-ad78-5b2415c98c51}
CortexM3OnMBED
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "LPC1768" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "LPC1768" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
//[assembly: Guid( "ffacd01c-fa64-4234-9058-1ad866f88c1a" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The default GC scheme will be Conservative Mark and Sweep.
// Only one of these should be enabled at a time
#define MarkAndSweepGC
namespace Microsoft.Llilum.LPC1768
{
using Chipset = Microsoft.CortexM3OnMBED;
#if ReferenceCountingGC
public sealed class ReferenceCountingCollector : Microsoft.Zelig.Runtime.ReferenceCountingCollector
{
}
#endif
#if StrincReferenceCountingGC
public sealed class StrictReferenceCountingCollector : Microsoft.Zelig.Runtime.StrictReferenceCountingCollector
{
}
#endif
#if MarkAndSweepGC
public sealed class ConservativeMarkAndSweepCollector : Microsoft.Zelig.Runtime.ConservativeMarkAndSweepCollector
{
}
#endif
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using ChipsetModel = Microsoft.CortexM3OnMBED;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class ThreadManager : ChipsetModel.ThreadManager
{
private const int DefaultStackSizeLPC1768 = 2 * 1024;
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
uint stackSize = LLOS.RuntimeMemory.LLOS_MEMORY_GetDefaultManagedStackSize();
if(stackSize == 0)
{
return DefaultStackSizeLPC1768;
}
return (int)stackSize;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.LPC1768
{
using Chipset = Microsoft.CortexM0OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("LPC1768")]
public sealed class LPC1768SoC : ProcessorCategory
{
[DependsOn(typeof(LPC1768SoC))]
[DisplayName("Internal 32KB Static RAM")]
[Defaults ( "BaseAddress" , 0x10000000 )]
[Defaults ( "SizeInBytes" , 32 * 1024 )]
[Defaults ( "WordSize" , 32 )]
[Defaults ( "WaitStates" , 0 )]
[EnumDefaults( "Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
public sealed class InternalRAM32KB : RamMemoryCategory
{
}
[DependsOn( typeof( LPC1768SoC ) )]
[DisplayName( "Internal 512KB FLASH" )]
[Defaults( "BaseAddress", 0x00000000 )]
[Defaults( "SizeInBytes", 512 * 1024 )]
[Defaults( "WordSize" , 32 )]
[Defaults( "WaitStates" , 0 )]
[EnumDefaults( "Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
public sealed class InternalFlash512KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName( "Memory Map for LPC1768" )]
public sealed class LPC1768MemoryMap : MemoryMapCategory
{
[MergeEnumDefaults( "Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint )]
[MemorySection( MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code )]
[AllowedOptions( typeof( LPC1768SoC.InternalRAM32KB ) )]
[Defaults( "BaseAddress", 0x10000000U )]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults( "Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint )]
[MemorySection( MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation )]
[AllowedOptions( typeof( LPC1768SoC.InternalFlash512KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LPC1768 MBED")]
public sealed class LPC1768 : ProductCategory
{
[AllowedOptions(typeof(LPC1768SoC))]
[Defaults("CoreClockFrequency" , 96000000UL)]
[Defaults("RealTimeClockFrequency" , 1000000UL )]
[Defaults("DefaultThreadPoolThreads", 2)]
[Defaults("DefaultTimerPoolThreads" , 1)]
public LPC1768SoC Processor;
//--//
[AllowedOptions( typeof( LPC1768SoC.InternalRAM32KB ) )]
[Defaults( "BaseAddress", 0x10000000U )]
public RamMemoryCategory InternalRam;
[AllowedOptions( typeof( LPC1768SoC.InternalFlash512KB ) )]
[Defaults( "BaseAddress", 0x00000000U )]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for LPC1768")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7M))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(LPC1768))]
[Defaults("MemoryMap", typeof(LPC1768MemoryMap))]
public sealed class LPC1768MBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Configuration/LPC1768.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m3
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.LPC1768.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.LPC1768MBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference LPC1768
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
-CompilationOption System.String GarbageCollectionManager ConservativeMarkAndSweepCollector
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Configuration/LPC1768Configuration.csproj
================================================
Debug
AnyCPU
{C17E59D0-2D64-4012-8A98-D184D0CF8A49}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.LPC1768
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\Debug\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\Release\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/LPC1768/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.LPC1768")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.LPC1768")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c17e59d0-2d64-4012-8a98-d184d0cf8a49")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class Board : Chipset.Board
{
internal const int GPIO_PORT_SHIFT = 12;
//
// Serial Ports
//
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_serialPorts = { "UART2", "UART3" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART2 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PA_14,
RxPin = (int)PinName.PA_15,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART3 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PB_11,
RxPin = (int)PinName.PC_4 ,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)STM32F091.PinName.LED1,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)STM32F091.PinName.PB_0,
};
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 51;
}
}
public override int PinToIndex( int pin )
{
return pin;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Port
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART2":
return UART2;
case "UART3":
return UART3;
default:
return null;
}
}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIM2_IRQn;
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART2":
return (int)IRQn.USART2_IRQn;
case "UART3":
return (int)IRQn.USART3_8_IRQn;
default:
throw new NotSupportedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using RT = Microsoft.Zelig.Runtime;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class Device : Microsoft.CortexM0OnMBED.Device
{
[RT.MemoryUsage(RT.MemoryUsage.Stack, ContentsUninitialized = true, AllocateFromHighAddress = true)]
static readonly uint[] s_bootstrapStackSTM32F091 = new uint[ 1024 / sizeof( uint ) ];
//
// Access Methods
//
public override uint[] BootstrapStack
{
get
{
return s_bootstrapStackSTM32F091;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.STM32F091.Drivers
{
using System.Runtime.CompilerServices;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.DeviceModels.Chipset.CortexM0.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
protected override uint GetTicksForQuantumValue( uint ms )
{
// STM32F411 uses the Core clock (100Mhz) for SysTick
return (uint)( RT.Configuration.CoreClockFrequency / 1000 ) * ms;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091.Drivers
{
using Chipset = Microsoft.CortexM0OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091.Drivers
{
using Chipset = Microsoft.CortexM0OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
//--//
public enum PinName : uint
{
PA_0 = 0x00,
PA_1 = 0x01,
PA_2 = 0x02,
PA_3 = 0x03,
PA_4 = 0x04,
PA_5 = 0x05,
PA_6 = 0x06,
PA_7 = 0x07,
PA_8 = 0x08,
PA_9 = 0x09,
PA_10 = 0x0A,
PA_11 = 0x0B,
PA_12 = 0x0C,
PA_13 = 0x0D,
PA_14 = 0x0E,
PA_15 = 0x0F,
PB_0 = 0x10,
PB_1 = 0x11,
PB_2 = 0x12,
PB_3 = 0x13,
PB_4 = 0x14,
PB_5 = 0x15,
PB_6 = 0x16,
PB_7 = 0x17,
PB_8 = 0x18,
PB_9 = 0x19,
PB_10 = 0x1A,
PB_11 = 0x1B,
PB_12 = 0x1C,
PB_13 = 0x1D,
PB_14 = 0x1E,
PB_15 = 0x1F,
PC_0 = 0x20,
PC_1 = 0x21,
PC_2 = 0x22,
PC_3 = 0x23,
PC_4 = 0x24,
PC_5 = 0x25,
PC_6 = 0x26,
PC_7 = 0x27,
PC_8 = 0x28,
PC_9 = 0x29,
PC_10 = 0x2A,
PC_11 = 0x2B,
PC_12 = 0x2C,
PC_13 = 0x2D,
PC_14 = 0x2E,
PC_15 = 0x2F,
PD_2 = 0x32,
PF_0 = 0x50,
PF_1 = 0x51,
PF_11 = 0x5B,
// Arduino connector namings
A0 = PA_0,
A1 = PA_1,
A2 = PA_4,
A3 = PB_0,
A4 = PC_1,
A5 = PC_0,
D0 = PA_3,
D1 = PA_2,
D2 = PA_10,
D3 = PB_3,
D4 = PB_5,
D5 = PB_4,
D6 = PB_10,
D7 = PA_8,
D8 = PA_9,
D9 = PC_7,
D10 = PB_6,
D11 = PA_7,
D12 = PA_6,
D13 = PA_5,
D14 = PB_9,
D15 = PB_8,
// Generic signals namings
LED1 = PA_5,
LED2 = PA_5,
LED3 = PA_5,
LED4 = PA_5,
USER_BUTTON = PC_13,
SERIAL_TX = PA_2,
SERIAL_RX = PA_3,
USBTX = PA_2,
USBRX = PA_3,
I2C_SCL = PB_8,
I2C_SDA = PB_9,
SPI_MOSI = PA_7,
SPI_MISO = PA_6,
SPI_SCK = PA_5,
SPI_CS = PB_6,
PWM_OUT = PB_4,
// Not connected
NC = unchecked(0xFFFFFFFF)
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091.HardwareModel.HardwareProviders
{
using System;
using Chipset = CortexM0OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
public override int GetGpioPinIRQNumber(int pinNumber)
{
int pinIndex = pinNumber & 0xF;
switch (pinIndex)
{
case 0:
case 1:
return (int)IRQn.EXTI0_1_IRQn;
case 2:
case 3:
return (int)IRQn.EXTI2_3_IRQn;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
return (int)IRQn.EXTI4_15_IRQn;
default:
throw new NotImplementedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SclPin = (int)PinName.I2C_SCL,
SdaPin = (int)PinName.I2C_SDA,
PortIndex = 0,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.PA_7,
Miso = (int)PinName.PA_6,
Sclk = (int)PinName.PA_5,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.PB_15,
Miso = (int)PinName.PB_14,
Sclk = (int)PinName.PB_13,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return false;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class AdcProviderUwp : RT.AdcProviderUwp
{
private static readonly RT.AdcChannelInfoUwp m_adcInfo = new RT.AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] { (int)PinName.PB_1, (int)PinName.PC_2, (int)PinName.PC_3, (int)PinName.PC_4, (int)PinName.PC_5 }
};
public override RT.AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.PWM_OUT,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM0;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_spiDevices = { "SPI1", "SPI2" };
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI1":
return SPI0;
case "SPI2":
return SPI1;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
enum IRQn
{
/****** Cortex-M0 Processor Exceptions Numbers **************************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */
SVC_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */
/****** STM32F091xC specific Interrupt Numbers **************************************************/
WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
PVD_VDDIO2_IRQn = 1, /*!< PVD & VDDIO2 Interrupts through EXTI Lines 16 and 31 */
RTC_IRQn = 2, /*!< RTC Interrupt through EXTI Lines 17, 19 and 20 */
FLASH_IRQn = 3, /*!< FLASH global Interrupt */
RCC_CRS_IRQn = 4, /*!< RCC & CRS global Interrupts */
EXTI0_1_IRQn = 5, /*!< EXTI Line 0 and 1 Interrupts */
EXTI2_3_IRQn = 6, /*!< EXTI Line 2 and 3 Interrupts */
EXTI4_15_IRQn = 7, /*!< EXTI Line 4 to 15 Interrupts */
TSC_IRQn = 8, /*!< Touch Sensing Controller Interrupts */
DMA1_Ch1_IRQn = 9, /*!< DMA1 Channel 1 Interrupt */
DMA1_Ch2_3_DMA2_Ch1_2_IRQn = 10, /*!< DMA1 Channel 2 and 3 & DMA2 Channel 1 and 2 Interrupts */
DMA1_Ch4_7_DMA2_Ch3_5_IRQn = 11, /*!< DMA1 Channel 4 to 7 & DMA2 Channel 3 to 5 Interrupts */
ADC1_COMP_IRQn = 12, /*!< ADC, COMP1 and COMP2 Interrupts (EXTI Lines 21 and 22) */
TIM1_BRK_UP_TRG_COM_IRQn = 13, /*!< TIM1 Break, Update, Trigger and Commutation Interrupts */
TIM1_CC_IRQn = 14, /*!< TIM1 Capture Compare Interrupt */
TIM2_IRQn = 15, /*!< TIM2 global Interrupt */
TIM3_IRQn = 16, /*!< TIM3 global Interrupt */
TIM6_DAC_IRQn = 17, /*!< TIM6 global and DAC channel underrun error Interrupts */
TIM7_IRQn = 18, /*!< TIM7 global Interrupt */
TIM14_IRQn = 19, /*!< TIM14 global Interrupt */
TIM15_IRQn = 20, /*!< TIM15 global Interrupt */
TIM16_IRQn = 21, /*!< TIM16 global Interrupt */
TIM17_IRQn = 22, /*!< TIM17 global Interrupt */
I2C1_IRQn = 23, /*!< I2C1 Event Interrupt & EXTI Line23 Interrupt (I2C1 wakeup) */
I2C2_IRQn = 24, /*!< I2C2 Event Interrupt */
SPI1_IRQn = 25, /*!< SPI1 global Interrupt */
SPI2_IRQn = 26, /*!< SPI2 global Interrupt */
USART1_IRQn = 27, /*!< USART1 global Interrupt & EXTI Line25 Interrupt (USART1 wakeup) */
USART2_IRQn = 28, /*!< USART2 global Interrupt & EXTI Line26 Interrupt (USART2 wakeup) */
USART3_8_IRQn = 29, /*!< USART3 to USART8 global Interrupts */
CEC_CAN_IRQn = 30, /*!< CEC and CAN global Interrupts & EXTI Line27 Interrupt */
LAST = 31,
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ALLOW_PAUSE
namespace Microsoft.Llilum.STM32F091
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM0OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/HardwareModel/Processor.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using System.Runtime.InteropServices;
using RT = Microsoft.Zelig.Runtime;
using ChipsetModel = Microsoft.CortexM0OnMBED;
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.STM32F091")]
public sealed class Processor : Microsoft.CortexM0OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
{
public Context(RT.ThreadImpl owner) : base(owner)
{
}
public override unsafe void SwitchTo( )
{
base.SwitchTo( );
}
}
//
// Helper methods
//
[RT.Inline]
public override void InitializeProcessor()
{
base.InitializeProcessor( );
}
[RT.Inline]
public override Microsoft.Zelig.Runtime.Processor.Context AllocateProcessorContext(RT.ThreadImpl owner)
{
return new Context(owner);
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("STM32F091")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("STM32F091")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6194144a-f8b1-4525-829f-061df4a5645a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/STM32F091.csproj
================================================
Debug
AnyCPU
{65E36DF8-5CB8-4582-851E-F5381AE4A1A7}
Library
Properties
Microsoft.Llilum.STM32F091
STM32F091
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{B8FE271A-CD41-435E-8766-4DB7609C1007}
CortexM0OnCMSIS-Core
{89EBDBB0-C81F-4611-B719-B385DF215F8D}
CortexM0OnMBED
{C3BFAFAD-A6C6-471D-A059-B3CB7E57A4AB}
ModelForCortexM0
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM4.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using Chipset = Microsoft.CortexM0OnMBED;
public sealed class GarbageCollectionManager : Chipset.GarbageCollectionManager
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using Chipset = Microsoft.CortexM0OnMBED;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class ThreadManager : Chipset.ThreadManager
{
private const int DefaultStackSizeSTM32F091 = 2 * 1024;
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
uint stackSize = LLOS.RuntimeMemory.LLOS_MEMORY_GetDefaultManagedStackSize();
if(stackSize == 0)
{
return DefaultStackSizeSTM32F091;
}
return (int)stackSize;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F091
{
using Chipset = Microsoft.CortexM0OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("STM32F091")]
public sealed class STM32F091SoC : ProcessorCategory
{
[DependsOn(typeof(STM32F091SoC))]
[DisplayName("Internal 32KB Static RAM")]
[Defaults("BaseAddress", 0x20000000U)]
[Defaults("SizeInBytes", 32 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalRAM32KB : RamMemoryCategory
{
}
[DependsOn(typeof(STM32F091SoC))]
[DisplayName("Internal 256KB FLASH")]
[Defaults("BaseAddress", 0x08000000U)]
[Defaults("SizeInBytes", 256 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalFlash256KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName("Memory Map for STM32F091")]
public sealed class STM32F091MemoryMap : MemoryMapCategory
{
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
[MemorySection(MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code)]
[AllowedOptions(typeof(STM32F091SoC.InternalRAM32KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint)]
[MemorySection(MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation)]
[AllowedOptions(typeof(STM32F091SoC.InternalFlash256KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("STM32F091 MBED")]
public sealed class STM32F091 : ProductCategory
{
[AllowedOptions(typeof(STM32F091SoC))]
[Defaults("CoreClockFrequency", 48000000UL)]
[Defaults("RealTimeClockFrequency", 1000000UL)]
[Defaults("DefaultThreadPoolThreads", 1)]
[Defaults("DefaultTimerPoolThreads", 1)]
public STM32F091SoC Processor;
//--//
[AllowedOptions(typeof(STM32F091SoC.InternalRAM32KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRam;
[AllowedOptions(typeof(STM32F091SoC.InternalFlash256KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for STM32F091")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV6M))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(STM32F091))]
[Defaults("MemoryMap", typeof(STM32F091MemoryMap))]
public sealed class STM32F091MBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.STM32F091")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.STM32F091")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("DA8F4085-A48D-4B75-ACF7-4735279B4D96")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Configuration/STM32F091.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m0
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F091.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F091MBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM0OnMBED
-Reference Microsoft.CortexM0OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM0
-Reference STM32F091
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath c:\src\llvm\llvm-3.7.0.src\build\x64\Release\bin
================================================
FILE: Zelig/BoardConfigurations/STM32F091/Configuration/STM32F091Configuration.csproj
================================================
Debug
AnyCPU
{C183991C-1F27-4665-A884-FD977D2AD359}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.STM32F091
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class Board : Chipset.Board
{
internal const int GPIO_PORT_SHIFT = 12;
//
// Serial Ports
//
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_serialPorts = { "UART1", "UART2", "UART6" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PA_9,
RxPin = (int)PinName.PA_10,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART2 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART6 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PA_11,
RxPin = (int)PinName.PA_12,
RtsPin = unchecked((int)PinName.NC),
CtsPin = unchecked((int)PinName.NC)
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)STM32F401.PinName.LED1,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)STM32F401.PinName.D3,
};
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 48;
}
}
public override int PinToIndex( int pin )
{
return pin;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Port
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART1":
return UART1;
case "UART2":
return UART2;
case "UART6":
return UART6;
default:
return null;
}
}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIM2_IRQn;
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART1":
return (int)IRQn.USART1_IRQn;
case "UART2":
return (int)IRQn.USART2_IRQn;
case "UART6":
return (int)IRQn.USART6_IRQn;
default:
throw new NotSupportedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using RT = Microsoft.Zelig.Runtime;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class Device : Microsoft.CortexM4OnMBED.Device
{
[RT.MemoryUsage(RT.MemoryUsage.Stack, ContentsUninitialized = true, AllocateFromHighAddress = true)]
static readonly uint[] s_bootstrapStackSTM32F401 = new uint[ 1024 / sizeof( uint ) ];
//
// Access Methods
//
public override uint[] BootstrapStack
{
get
{
return s_bootstrapStackSTM32F401;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.STM32F401.Drivers
{
using System.Runtime.CompilerServices;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.DeviceModels.Chipset.CortexM4.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
protected override uint GetTicksForQuantumValue( uint ms )
{
// STM32F411 uses the Core clock (100Mhz) for SysTick
return (uint)( RT.Configuration.CoreClockFrequency / 1000 ) * ms;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
//--//
public enum PinName : uint
{
PA_0 = 0x00,
PA_1 = 0x01,
PA_2 = 0x02,
PA_3 = 0x03,
PA_4 = 0x04,
PA_5 = 0x05,
PA_6 = 0x06,
PA_7 = 0x07,
PA_8 = 0x08,
PA_9 = 0x09,
PA_10 = 0x0A,
PA_11 = 0x0B,
PA_12 = 0x0C,
PA_13 = 0x0D,
PA_14 = 0x0E,
PA_15 = 0x0F,
PB_0 = 0x10,
PB_1 = 0x11,
PB_2 = 0x12,
PB_3 = 0x13,
PB_4 = 0x14,
PB_5 = 0x15,
PB_6 = 0x16,
PB_7 = 0x17,
PB_8 = 0x18,
PB_9 = 0x19,
PB_10 = 0x1A,
PB_12 = 0x1C,
PB_13 = 0x1D,
PB_14 = 0x1E,
PB_15 = 0x1F,
PC_0 = 0x20,
PC_1 = 0x21,
PC_2 = 0x22,
PC_3 = 0x23,
PC_4 = 0x24,
PC_5 = 0x25,
PC_6 = 0x26,
PC_7 = 0x27,
PC_8 = 0x28,
PC_9 = 0x29,
PC_10 = 0x2A,
PC_11 = 0x2B,
PC_12 = 0x2C,
PC_13 = 0x2D,
PC_14 = 0x2E,
PC_15 = 0x2F,
// Unsure what these are. Modify PinToIndex to accomodate for these if needed
PD_2 = 0x32,
PH_0 = 0x70,
PH_1 = 0x71,
// Arduino connector namings
A0 = PA_0,
A1 = PA_1,
A2 = PA_4,
A3 = PB_0,
A4 = PC_1,
A5 = PC_0,
D0 = PA_3,
D1 = PA_2,
D2 = PA_10,
D3 = PB_3,
D4 = PB_5,
D5 = PB_4,
D6 = PB_10,
D7 = PA_8,
D8 = PA_9,
D9 = PC_7,
D10 = PB_6,
D11 = PA_7,
D12 = PA_6,
D13 = PA_5,
D14 = PB_9,
D15 = PB_8,
// Generic signals namings
LED1 = PA_5,
LED2 = PA_5,
LED3 = PA_5,
LED4 = PA_5,
USER_BUTTON = PC_13,
SERIAL_TX = PA_2,
SERIAL_RX = PA_3,
USBTX = PA_2,
USBRX = PA_3,
I2C_SCL = PB_8,
I2C_SDA = PB_9,
SPI_MOSI = PA_7,
SPI_MISO = PA_6,
SPI_SCK = PA_5,
SPI_CS = PB_6,
PWM_OUT = PB_3,
// Not connected
NC = unchecked(0xFFFFFFFF),
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401.HardwareModel.HardwareProviders
{
using System;
using Chipset = CortexM4OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
public override int GetGpioPinIRQNumber(int pinNumber)
{
int pinIndex = pinNumber & 0xF;
switch (pinIndex)
{
case 0:
return (int)IRQn.EXTI0_IRQn;
case 1:
return (int)IRQn.EXTI1_IRQn;
case 2:
return (int)IRQn.EXTI2_IRQn;
case 3:
return (int)IRQn.EXTI3_IRQn;
case 4:
return (int)IRQn.EXTI4_IRQn;
case 5:
case 6:
case 7:
case 8:
case 9:
return (int)IRQn.EXTI9_5_IRQn;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
return (int)IRQn.EXTI15_10_IRQn;
default:
throw new NotImplementedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SclPin = (int)PinName.I2C_SCL,
SdaPin = (int)PinName.I2C_SDA,
PortIndex = 0,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.PA_7,
Miso = (int)PinName.PA_6,
Sclk = (int)PinName.PA_5,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.PB_15,
Miso = (int)PinName.PB_14,
Sclk = (int)PinName.PB_13,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI2 = new SpiChannelInfo()
{
Mosi = (int)PinName.PC_12,
Miso = (int)PinName.PC_11,
Sclk = (int)PinName.PC_10,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return false;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
case 2:
return SPI2;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class AdcProviderUwp : RT.AdcProviderUwp
{
private static readonly RT.AdcChannelInfoUwp m_adcInfo = new RT.AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] { (int)PinName.A0, (int)PinName.A1, (int)PinName.A2, (int)PinName.A3, (int)PinName.A4, (int)PinName.A5 }
};
public override RT.AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.A0,
(int)PinName.A1,
(int)PinName.A3,
(int)PinName.D0,
(int)PinName.D1,
(int)PinName.D2,
(int)PinName.D3,
(int)PinName.D4,
(int)PinName.D5,
(int)PinName.D6,
(int)PinName.D7,
(int)PinName.D8,
(int)PinName.D9,
(int)PinName.D10,
(int)PinName.D11,
(int)PinName.D12,
(int)PinName.D13,
(int)PinName.D14,
(int)PinName.D15,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_spiDevices = { "SPI1", "SPI2", "SPI3" };
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public static readonly SpiChannelInfoUwp SPI2 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI2,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI1":
return SPI0;
case "SPI2":
return SPI1;
case "SPI3":
return SPI2;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
enum IRQn
{
/****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */
SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */
/****** STM32 specific Interrupt Numbers **********************************************************************/
WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */
RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line */
FLASH_IRQn = 4, /*!< FLASH global Interrupt */
RCC_IRQn = 5, /*!< RCC global Interrupt */
EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
DMA1_Stream0_IRQn = 11, /*!< DMA1 Stream 0 global Interrupt */
DMA1_Stream1_IRQn = 12, /*!< DMA1 Stream 1 global Interrupt */
DMA1_Stream2_IRQn = 13, /*!< DMA1 Stream 2 global Interrupt */
DMA1_Stream3_IRQn = 14, /*!< DMA1 Stream 3 global Interrupt */
DMA1_Stream4_IRQn = 15, /*!< DMA1 Stream 4 global Interrupt */
DMA1_Stream5_IRQn = 16, /*!< DMA1 Stream 5 global Interrupt */
DMA1_Stream6_IRQn = 17, /*!< DMA1 Stream 6 global Interrupt */
ADC_IRQn = 18, /*!< ADC1, ADC2 and ADC3 global Interrupts */
EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
TIM1_BRK_TIM9_IRQn = 24, /*!< TIM1 Break interrupt and TIM9 global interrupt */
TIM1_UP_TIM10_IRQn = 25, /*!< TIM1 Update Interrupt and TIM10 global interrupt */
TIM1_TRG_COM_TIM11_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */
TIM2_IRQn = 28, /*!< TIM2 global Interrupt */
TIM3_IRQn = 29, /*!< TIM3 global Interrupt */
TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
USART1_IRQn = 37, /*!< USART1 global Interrupt */
USART2_IRQn = 38, /*!< USART2 global Interrupt */
EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line Interrupt */
OTG_FS_WKUP_IRQn = 42, /*!< USB OTG FS Wakeup through EXTI line interrupt */
DMA1_Stream7_IRQn = 47, /*!< DMA1 Stream7 Interrupt */
SDIO_IRQn = 49, /*!< SDIO global Interrupt */
TIM5_IRQn = 50, /*!< TIM5 global Interrupt */
SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
DMA2_Stream0_IRQn = 56, /*!< DMA2 Stream 0 global Interrupt */
DMA2_Stream1_IRQn = 57, /*!< DMA2 Stream 1 global Interrupt */
DMA2_Stream2_IRQn = 58, /*!< DMA2 Stream 2 global Interrupt */
DMA2_Stream3_IRQn = 59, /*!< DMA2 Stream 3 global Interrupt */
DMA2_Stream4_IRQn = 60, /*!< DMA2 Stream 4 global Interrupt */
OTG_FS_IRQn = 67, /*!< USB OTG FS global Interrupt */
DMA2_Stream5_IRQn = 68, /*!< DMA2 Stream 5 global interrupt */
DMA2_Stream6_IRQn = 69, /*!< DMA2 Stream 6 global interrupt */
DMA2_Stream7_IRQn = 70, /*!< DMA2 Stream 7 global interrupt */
USART6_IRQn = 71, /*!< USART6 global interrupt */
I2C3_EV_IRQn = 72, /*!< I2C3 event interrupt */
I2C3_ER_IRQn = 73, /*!< I2C3 error interrupt */
FPU_IRQn = 81, /*!< FPU global interrupt */
SPI4_IRQn = 84, /*!< SPI4 global Interrupt */
LAST = 85,
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ALLOW_PAUSE
namespace Microsoft.Llilum.STM32F401
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/HardwareModel/Processor.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using System.Runtime.InteropServices;
using RT = Microsoft.Zelig.Runtime;
using ChipsetModel = Microsoft.CortexM4OnMBED;
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.STM32F411")]
public sealed class Processor : Microsoft.CortexM4OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
{
public Context(RT.ThreadImpl owner) : base(owner)
{
}
public override unsafe void SwitchTo( )
{
//
// BUGBUG: return to thread using VFP state as well
//
base.SwitchTo( );
}
}
//
// Helper methods
//
[RT.Inline]
public override void InitializeProcessor()
{
base.InitializeProcessor( );
DisableMPU( );
}
[RT.Inline]
public override Microsoft.Zelig.Runtime.Processor.Context AllocateProcessorContext(RT.ThreadImpl owner)
{
return new Context(owner);
}
//--//
private unsafe void DisableMPU()
{
CUSTOM_STUB_STM32F4xx_DisableMPU( );
}
[DllImport( "C" )]
private static extern void CUSTOM_STUB_STM32F4xx_DisableMPU( );
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("STM32F401")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("STM32F401")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6194144a-f8b1-4525-829f-061df4a5645a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/STM32F401.csproj
================================================
Debug
AnyCPU
{6194144A-F8B1-4525-829F-061DF4A5645A}
Library
Properties
Microsoft.Llilum.STM32F401
STM32F401
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{B8FE271A-CD41-435E-8766-4DB7609C1007}
CortexM0OnCMSIS-Core
{89EBDBB0-C81F-4611-B719-B385DF215F8D}
CortexM0OnMBED
{C3BFAFAD-A6C6-471D-A059-B3CB7E57A4AB}
ModelForCortexM0
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{0b37e5ba-4839-4ec4-9e36-a96bcbea2400}
CortexM3OnCMSIS-Core
{0c522c6a-0f77-4af8-ad78-5b2415c98c51}
CortexM3OnMBED
{7fb3f581-742d-4e12-a36a-be172c574ab0}
CortexM4OnCMSIS-Core
{65c8eda6-ac24-4e18-a5b5-216e0f2c3906}
CortexM4OnMBED
{a30eb003-94f8-4a85-8da1-006f6810a7a4}
ModelForCortexM3
{ca8a6d38-528b-4faa-89b6-8fa9178de55d}
ModelForCortexM4
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM4.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class GarbageCollectionManager : Chipset.GarbageCollectionManager
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using Chipset = Microsoft.CortexM4OnMBED;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class ThreadManager : Chipset.ThreadManager
{
private const int DefaultStackSizeSTM32F411 = 4 * 1024;
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
uint stackSize = LLOS.RuntimeMemory.LLOS_MEMORY_GetDefaultManagedStackSize();
if(stackSize == 0)
{
return DefaultStackSizeSTM32F411;
}
return (int)stackSize;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F401
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("STM32F401")]
public sealed class STM32F401SoC : ProcessorCategory
{
[DependsOn(typeof(STM32F401SoC))]
[DisplayName("Internal 96KB Static RAM")]
[Defaults("BaseAddress", 0x20000000U)]
[Defaults("SizeInBytes", 96 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalRAM96KB : RamMemoryCategory
{
}
[DependsOn(typeof(STM32F401SoC))]
[DisplayName("Internal 512KB FLASH")]
[Defaults("BaseAddress", 0x08000000U)]
[Defaults("SizeInBytes", 512 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalFlash512KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName("Memory Map for STM32F401")]
public sealed class STM32F401MemoryMap : MemoryMapCategory
{
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
[MemorySection(MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code)]
[AllowedOptions(typeof(STM32F401SoC.InternalRAM96KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint)]
[MemorySection(MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation)]
[AllowedOptions(typeof(STM32F401SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("STM32F401 MBED")]
public sealed class STM32F401 : ProductCategory
{
[AllowedOptions(typeof(STM32F401SoC))]
[Defaults("CoreClockFrequency", 84000000UL)]
[Defaults("RealTimeClockFrequency", 1000000UL)]
[Defaults("DefaultThreadPoolThreads", 2)]
[Defaults("DefaultTimerPoolThreads", 2)]
public STM32F401SoC Processor;
//--//
[AllowedOptions(typeof(STM32F401SoC.InternalRAM96KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRam;
[AllowedOptions(typeof(STM32F401SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for STM32F401")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7M_VFP))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(STM32F401))]
[Defaults("MemoryMap", typeof(STM32F401MemoryMap))]
public sealed class STM32F401MBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7f600371-17ab-41f2-96ab-39c8aa2389e1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Configuration/STM32F401.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F401.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F401MBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference STM32F401
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: Zelig/BoardConfigurations/STM32F401/Configuration/STM32F401Configuration.csproj
================================================
Debug
AnyCPU
{7F600371-17AB-41F2-96AB-39C8AA2389E1}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.STM32F401
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class Board : Chipset.Board
{
internal const int GPIO_PORT_SHIFT = 12;
//
// Serial Ports
//
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_serialPorts = { "UART1", "UART2", "UART6" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART1 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PA_9 ,
RxPin = (int)PinName.PA_10,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART2 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART6 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PA_11,
RxPin = (int)PinName.PA_12,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)STM32F411.PinName.LED1,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)STM32F411.PinName.D3,
};
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 48;
}
}
public override int PinToIndex( int pin )
{
return pin;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Port
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART1":
return UART1;
case "UART2":
return UART2;
case "UART6":
return UART6;
default:
return null;
}
}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIM2_IRQn;
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART1":
return (int)IRQn.USART1_IRQn;
case "UART2":
return (int)IRQn.USART2_IRQn;
case "UART6":
return (int)IRQn.USART6_IRQn;
default:
throw new NotSupportedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using RT = Microsoft.Zelig.Runtime;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class Device : Microsoft.CortexM4OnMBED.Device
{
[RT.MemoryUsage(RT.MemoryUsage.Stack, ContentsUninitialized = true, AllocateFromHighAddress = true)]
static readonly uint[] s_bootstrapStackSTM32F411 = new uint[ 1024 / sizeof( uint ) ];
//
// Access Methods
//
public override uint[] BootstrapStack
{
get
{
return s_bootstrapStackSTM32F411;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.STM32F411.Drivers
{
using System.Runtime.CompilerServices;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.DeviceModels.Chipset.CortexM4.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
protected override uint GetTicksForQuantumValue( uint ms )
{
// STM32F411 uses the Core clock (100Mhz) for SysTick
return (uint)( RT.Configuration.CoreClockFrequency / 1000 ) * ms;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411.Drivers
{
using Chipset = Microsoft.CortexM4OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
//--//
public enum PinName : uint
{
PA_0 = 0x00,
PA_1 = 0x01,
PA_2 = 0x02,
PA_3 = 0x03,
PA_4 = 0x04,
PA_5 = 0x05,
PA_6 = 0x06,
PA_7 = 0x07,
PA_8 = 0x08,
PA_9 = 0x09,
PA_10 = 0x0A,
PA_11 = 0x0B,
PA_12 = 0x0C,
PA_13 = 0x0D,
PA_14 = 0x0E,
PA_15 = 0x0F,
PB_0 = 0x10,
PB_1 = 0x11,
PB_2 = 0x12,
PB_3 = 0x13,
PB_4 = 0x14,
PB_5 = 0x15,
PB_6 = 0x16,
PB_7 = 0x17,
PB_8 = 0x18,
PB_9 = 0x19,
PB_10 = 0x1A,
PB_12 = 0x1C,
PB_13 = 0x1D,
PB_14 = 0x1E,
PB_15 = 0x1F,
PC_0 = 0x20,
PC_1 = 0x21,
PC_2 = 0x22,
PC_3 = 0x23,
PC_4 = 0x24,
PC_5 = 0x25,
PC_6 = 0x26,
PC_7 = 0x27,
PC_8 = 0x28,
PC_9 = 0x29,
PC_10 = 0x2A,
PC_11 = 0x2B,
PC_12 = 0x2C,
PC_13 = 0x2D,
PC_14 = 0x2E,
PC_15 = 0x2F,
// Unsure what these are. Modify PinToIndex to accomodate for these if needed
PD_2 = 0x32,
PH_0 = 0x70,
PH_1 = 0x71,
// Arduino connector namings
A0 = PA_0,
A1 = PA_1,
A2 = PA_4,
A3 = PB_0,
A4 = PC_1,
A5 = PC_0,
D0 = PA_3,
D1 = PA_2,
D2 = PA_10,
D3 = PB_3,
D4 = PB_5,
D5 = PB_4,
D6 = PB_10,
D7 = PA_8,
D8 = PA_9,
D9 = PC_7,
D10 = PB_6,
D11 = PA_7,
D12 = PA_6,
D13 = PA_5,
D14 = PB_9,
D15 = PB_8,
// Generic signals namings
LED1 = PA_5,
LED2 = PA_5,
LED3 = PA_5,
LED4 = PA_5,
USER_BUTTON = PC_13,
SERIAL_TX = PA_2,
SERIAL_RX = PA_3,
USBTX = PA_2,
USBRX = PA_3,
I2C_SCL = PB_8,
I2C_SDA = PB_9,
SPI_MOSI = PA_7,
SPI_MISO = PA_6,
SPI_SCK = PA_5,
SPI_CS = PB_6,
PWM_OUT = PB_3,
// Not connected
NC = unchecked(0xFFFFFFFF),
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411.HardwareModel.HardwareProviders
{
using System;
using Chipset = CortexM4OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
public override int GetGpioPinIRQNumber(int pinNumber)
{
int pinIndex = pinNumber & 0xF;
switch (pinIndex)
{
case 0:
return (int)IRQn.EXTI0_IRQn;
case 1:
return (int)IRQn.EXTI1_IRQn;
case 2:
return (int)IRQn.EXTI2_IRQn;
case 3:
return (int)IRQn.EXTI3_IRQn;
case 4:
return (int)IRQn.EXTI4_IRQn;
case 5:
case 6:
case 7:
case 8:
case 9:
return (int)IRQn.EXTI9_5_IRQn;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
return (int)IRQn.EXTI15_10_IRQn;
default:
throw new NotImplementedException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SclPin = (int)PinName.I2C_SCL,
SdaPin = (int)PinName.I2C_SDA,
PortIndex = 0,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo()
{
Mosi = (int)PinName.PA_7,
Miso = (int)PinName.PA_6,
Sclk = (int)PinName.PA_5,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.PB_15,
Miso = (int)PinName.PB_14,
Sclk = (int)PinName.PB_13,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI2 = new SpiChannelInfo()
{
Mosi = (int)PinName.PC_12,
Miso = (int)PinName.PC_11,
Sclk = (int)PinName.PC_10,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return false;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
case 2:
return SPI2;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class AdcProviderUwp : RT.AdcProviderUwp
{
private static readonly RT.AdcChannelInfoUwp m_adcInfo = new RT.AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] { (int)PinName.A0, (int)PinName.A1, (int)PinName.A2, (int)PinName.A3, (int)PinName.A4, (int)PinName.A5 }
};
public override RT.AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.A0,
(int)PinName.A1,
(int)PinName.A3,
(int)PinName.D0,
(int)PinName.D1,
(int)PinName.D2,
(int)PinName.D3,
(int)PinName.D4,
(int)PinName.D5,
(int)PinName.D6,
(int)PinName.D7,
(int)PinName.D8,
(int)PinName.D9,
(int)PinName.D10,
(int)PinName.D11,
(int)PinName.D12,
(int)PinName.D13,
(int)PinName.D14,
(int)PinName.D15,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM4OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM4;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
// NOTICE: Names are 1-indexed as per STM Board Description
private static readonly string[] m_spiDevices = { "SPI1", "SPI2", "SPI3" };
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public static readonly SpiChannelInfoUwp SPI2 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI2,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI1":
return SPI0;
case "SPI2":
return SPI1;
case "SPI3":
return SPI2;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
enum IRQn
{
/****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */
SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */
/****** STM32 specific Interrupt Numbers **********************************************************************/
WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */
RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line */
FLASH_IRQn = 4, /*!< FLASH global Interrupt */
RCC_IRQn = 5, /*!< RCC global Interrupt */
EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
DMA1_Stream0_IRQn = 11, /*!< DMA1 Stream 0 global Interrupt */
DMA1_Stream1_IRQn = 12, /*!< DMA1 Stream 1 global Interrupt */
DMA1_Stream2_IRQn = 13, /*!< DMA1 Stream 2 global Interrupt */
DMA1_Stream3_IRQn = 14, /*!< DMA1 Stream 3 global Interrupt */
DMA1_Stream4_IRQn = 15, /*!< DMA1 Stream 4 global Interrupt */
DMA1_Stream5_IRQn = 16, /*!< DMA1 Stream 5 global Interrupt */
DMA1_Stream6_IRQn = 17, /*!< DMA1 Stream 6 global Interrupt */
ADC_IRQn = 18, /*!< ADC1, ADC2 and ADC3 global Interrupts */
EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
TIM1_BRK_TIM9_IRQn = 24, /*!< TIM1 Break interrupt and TIM9 global interrupt */
TIM1_UP_TIM10_IRQn = 25, /*!< TIM1 Update Interrupt and TIM10 global interrupt */
TIM1_TRG_COM_TIM11_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */
TIM2_IRQn = 28, /*!< TIM2 global Interrupt */
TIM3_IRQn = 29, /*!< TIM3 global Interrupt */
TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
USART1_IRQn = 37, /*!< USART1 global Interrupt */
USART2_IRQn = 38, /*!< USART2 global Interrupt */
EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line Interrupt */
OTG_FS_WKUP_IRQn = 42, /*!< USB OTG FS Wakeup through EXTI line interrupt */
DMA1_Stream7_IRQn = 47, /*!< DMA1 Stream7 Interrupt */
SDIO_IRQn = 49, /*!< SDIO global Interrupt */
TIM5_IRQn = 50, /*!< TIM5 global Interrupt */
SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
DMA2_Stream0_IRQn = 56, /*!< DMA2 Stream 0 global Interrupt */
DMA2_Stream1_IRQn = 57, /*!< DMA2 Stream 1 global Interrupt */
DMA2_Stream2_IRQn = 58, /*!< DMA2 Stream 2 global Interrupt */
DMA2_Stream3_IRQn = 59, /*!< DMA2 Stream 3 global Interrupt */
DMA2_Stream4_IRQn = 60, /*!< DMA2 Stream 4 global Interrupt */
OTG_FS_IRQn = 67, /*!< USB OTG FS global Interrupt */
DMA2_Stream5_IRQn = 68, /*!< DMA2 Stream 5 global interrupt */
DMA2_Stream6_IRQn = 69, /*!< DMA2 Stream 6 global interrupt */
DMA2_Stream7_IRQn = 70, /*!< DMA2 Stream 7 global interrupt */
USART6_IRQn = 71, /*!< USART6 global interrupt */
I2C3_EV_IRQn = 72, /*!< I2C3 event interrupt */
I2C3_ER_IRQn = 73, /*!< I2C3 error interrupt */
FPU_IRQn = 81, /*!< FPU global interrupt */
SPI4_IRQn = 84, /*!< SPI4 global Interrupt */
SPI5_IRQn = 85, /*!< SPI5 global Interrupt */
LAST = 86,
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ALLOW_PAUSE
namespace Microsoft.Llilum.STM32F411
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/HardwareModel/Processor.cs
================================================
//
// Copyright ((c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using System.Runtime.InteropServices;
using RT = Microsoft.Zelig.Runtime;
using ChipsetModel = Microsoft.CortexM4OnMBED;
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.STM32F411")]
public sealed class Processor : Microsoft.CortexM4OnMBED.Processor
{
public new class Context : ChipsetModel.Processor.Context
{
public Context(RT.ThreadImpl owner) : base(owner)
{
}
public override unsafe void SwitchTo( )
{
//
// BUGBUG: return to thread using VFP state as well
//
base.SwitchTo( );
}
}
//
// Helper methods
//
[RT.Inline]
public override void InitializeProcessor()
{
base.InitializeProcessor( );
DisableMPU( );
}
[RT.Inline]
public override Microsoft.Zelig.Runtime.Processor.Context AllocateProcessorContext(RT.ThreadImpl owner)
{
return new Context(owner);
}
//--//
private unsafe void DisableMPU()
{
CUSTOM_STUB_STM32F4xx_DisableMPU( );
}
[DllImport( "C" )]
private static extern void CUSTOM_STUB_STM32F4xx_DisableMPU( );
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("STM32F411")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("STM32F411")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dd4371de-85a8-49aa-b939-10e03b7ed3c9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/STM32F411.csproj
================================================
Debug
AnyCPU
{DD4371DE-85A8-49AA-B939-10E03B7ED3C9}
Library
Properties
Microsoft.Llilum.STMF411
STM32F411
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{b8fe271a-cd41-435e-8766-4db7609c1007}
CortexM0OnCMSIS-Core
{89ebdbb0-c81f-4611-b719-b385df215f8d}
CortexM0OnMBED
{0b37e5ba-4839-4ec4-9e36-a96bcbea2400}
CortexM3OnCMSIS-Core
{0c522c6a-0f77-4af8-ad78-5b2415c98c51}
CortexM3OnMBED
{7fb3f581-742d-4e12-a36a-be172c574ab0}
CortexM4OnCMSIS-Core
{65c8eda6-ac24-4e18-a5b5-216e0f2c3906}
CortexM4OnMBED
{c3bfafad-a6c6-471d-a059-b3cb7e57a4ab}
ModelForCortexM0
{a30eb003-94f8-4a85-8da1-006f6810a7a4}
ModelForCortexM3
{ca8a6d38-528b-4faa-89b6-8fa9178de55d}
ModelForCortexM4
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM0.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM0OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM0OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM4OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM4.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class GarbageCollectionManager : Chipset.GarbageCollectionManager
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using Chipset = Microsoft.CortexM4OnMBED;
using LLOS = Zelig.LlilumOSAbstraction.API;
public sealed class ThreadManager : Chipset.ThreadManager
{
private const int DefaultStackSizeSTM32F411 = 4 * 1024;
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
uint stackSize = LLOS.RuntimeMemory.LLOS_MEMORY_GetDefaultManagedStackSize();
if(stackSize == 0)
{
return DefaultStackSizeSTM32F411;
}
return (int)stackSize;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32F411
{
using Chipset = Microsoft.CortexM4OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("STM32F411")]
public sealed class STM32F411SoC : ProcessorCategory
{
[DependsOn(typeof(STM32F411SoC))]
[DisplayName("Internal 128KB Static RAM")]
[Defaults("BaseAddress", 0x20000000U)]
[Defaults("SizeInBytes", 128 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalRAM128KB : RamMemoryCategory
{
}
[DependsOn(typeof(STM32F411SoC))]
[DisplayName("Internal 512KB FLASH")]
[Defaults("BaseAddress", 0x08000000U)]
[Defaults("SizeInBytes", 512 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalFlash512KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName("Memory Map for STM32F411")]
public sealed class STM32F411MemoryMap : MemoryMapCategory
{
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
[MemorySection(MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code)]
[AllowedOptions(typeof(STM32F411SoC.InternalRAM128KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint)]
[MemorySection(MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation)]
[AllowedOptions(typeof(STM32F411SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("STM32F411 MBED")]
public sealed class STM32F411 : ProductCategory
{
[AllowedOptions(typeof(STM32F411SoC))]
[Defaults("CoreClockFrequency" , 100000000UL)]
[Defaults("RealTimeClockFrequency" , 1000000UL)]
[Defaults("DefaultThreadPoolThreads", 2)]
[Defaults("DefaultTimerPoolThreads" , 2)]
public STM32F411SoC Processor;
//--//
[AllowedOptions(typeof(STM32F411SoC.InternalRAM128KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRam;
[AllowedOptions(typeof(STM32F411SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x08000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for STM32F411")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7M_VFP))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(STM32F411))]
[Defaults("MemoryMap", typeof(STM32F411MemoryMap))]
public sealed class STM32F411MBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9b0edb62-1e62-492d-b807-a8501eee8400")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Configuration/STM32F411.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m4
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32F411.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32F411MBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM4OnMBED
-Reference Microsoft.CortexM4OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM4
-Reference STM32F411
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase ReduceNumberOfTemporaries TransformFinallyBlocksIntoTryBlocks ApplyClassExtensions
#-DumpIRBeforePhase All
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
###
### LLVM CodeGeneration
###
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: Zelig/BoardConfigurations/STM32F411/Configuration/STM32F411Configuration.csproj
================================================
Debug
AnyCPU
{9B0EDB62-1E62-492D-B807-A8501EEE8400}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.STM32F411
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Board.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class Board : Chipset.Board
{
//
// Serial Ports
//
private static readonly string[] m_serialPorts = { "UART2", "UART3", "UART4", "UART5" };
public static readonly ChipsetAbstration.Board.SerialPortInfo UART2 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.USBTX,
RxPin = (int)PinName.USBRX,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART3 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PB_10,
RxPin = (int)PinName.PB_11,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART4 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PC_10,
RxPin = (int)PinName.PC_11,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
public static readonly ChipsetAbstration.Board.SerialPortInfo UART5 = new ChipsetAbstration.Board.SerialPortInfo()
{
TxPin = (int)PinName.PC_12,
RxPin = (int)PinName.PD_2 ,
RtsPin = unchecked( (int)PinName.NC ),
CtsPin = unchecked( (int)PinName.NC ),
};
//--//
private static readonly int[] s_ledPins = new int[]
{
(int)STM32L152.PinName.LED1,
};
private static readonly int[] s_pwmPins = new int[]
{
(int)STM32L152.PinName.D3,
};
//
// Gpio discovery
//
public override int PinCount
{
get
{
return 64;
}
}
public override int PinToIndex( int pin )
{
return pin;
}
public override int NCPin
{
get
{
return -1;
}
}
public override int[] LedPins
{
get
{
return s_ledPins;
}
}
public override int[] PwmPins
{
get
{
return s_pwmPins;
}
}
//
// Serial Ports
//
public override string[] GetSerialPorts()
{
return m_serialPorts;
}
public override ChipsetAbstration.Board.SerialPortInfo GetSerialPortInfo(string portName)
{
switch (portName)
{
case "UART2":
return UART2;
case "UART3":
return UART3;
case "UART4":
return UART4;
case "UART5":
return UART5;
default:
return null;
}
}
public override int GetSerialPortIRQ(string portName)
{
switch (portName)
{
case "UART2":
return (int)IRQn.USART2_IRQn;
case "UART3":
return (int)IRQn.USART3_IRQn;
case "UART4":
return (int)IRQn.UART4_IRQn;
case "UART5":
return (int)IRQn.UART5_IRQn;
default:
throw new NotSupportedException();
}
}
//
// System timer
//
public override int GetSystemTimerIRQ( )
{
return (int)IRQn.TIM5_IRQn;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Device.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using Chipset = Microsoft.CortexM3OnMBED;
public sealed class Device : Chipset.Device
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Drivers/ContextSwitchTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TIMERS_SELF_TEST
namespace Microsoft.Llilum.STM32L152.Drivers
{
using Chipset = Microsoft.DeviceModels.Chipset.CortexM3.Drivers;
public sealed class ContextSwitchTimer : Chipset.ContextSwitchTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Drivers/InterruptController.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152.Drivers
{
using Chipset = Microsoft.CortexM3OnMBED.Drivers;
public sealed class InterruptController : Chipset.InterruptController
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Drivers/SystemTimer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152.Drivers
{
using Chipset = Microsoft.CortexM3OnMBED.Drivers;
public sealed class SystemTimer : Chipset.SystemTimer
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/GPIO.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
//--//
public enum PinDirection
{
PIN_INPUT,
PIN_OUTPUT
}
public enum PinMode
{
PullUp = 0,
PullDown = 3,
PullNone = 2,
Repeater = 1,
OpenDrain = 4,
PullDefault = PullDown
}
public enum PinName : uint
{
PA_0 = 0x00,
PA_1 = 0x01,
PA_2 = 0x02,
PA_3 = 0x03,
PA_4 = 0x04,
PA_5 = 0x05,
PA_6 = 0x06,
PA_7 = 0x07,
PA_8 = 0x08,
PA_9 = 0x09,
PA_10 = 0x0A,
PA_11 = 0x0B,
PA_12 = 0x0C,
PA_13 = 0x0D,
PA_14 = 0x0E,
PA_15 = 0x0F,
PB_0 = 0x10,
PB_1 = 0x11,
PB_2 = 0x12,
PB_3 = 0x13,
PB_4 = 0x14,
PB_5 = 0x15,
PB_6 = 0x16,
PB_7 = 0x17,
PB_8 = 0x18,
PB_9 = 0x19,
PB_10 = 0x1A,
PB_11 = 0x1B,
PB_12 = 0x1C,
PB_13 = 0x1D,
PB_14 = 0x1E,
PB_15 = 0x1F,
PC_0 = 0x20,
PC_1 = 0x21,
PC_2 = 0x22,
PC_3 = 0x23,
PC_4 = 0x24,
PC_5 = 0x25,
PC_6 = 0x26,
PC_7 = 0x27,
PC_8 = 0x28,
PC_9 = 0x29,
PC_10 = 0x2A,
PC_11 = 0x2B,
PC_12 = 0x2C,
PC_13 = 0x2D,
PC_14 = 0x2E,
PC_15 = 0x2F,
PD_2 = 0x32,
PH_0 = 0x70,
PH_1 = 0x71,
// Arduino connector namings
A0 = PA_0,
A1 = PA_1,
A2 = PA_4,
A3 = PB_0,
A4 = PC_1,
A5 = PC_0,
D0 = PA_3,
D1 = PA_2,
D2 = PA_10,
D3 = PB_3,
D4 = PB_5,
D5 = PB_4,
D6 = PB_10,
D7 = PA_8,
D8 = PA_9,
D9 = PC_7,
D10 = PB_6,
D11 = PA_7,
D12 = PA_6,
D13 = PA_5,
D14 = PB_9,
D15 = PB_8,
// Generic signals namings
LED1 = PA_5,
LED2 = PA_5,
LED3 = PA_5,
LED4 = PA_5,
USER_BUTTON = PC_13,
SERIAL_TX = PA_2,
SERIAL_RX = PA_3,
USBTX = PA_2,
USBRX = PA_3,
I2C_SCL = PB_8,
I2C_SDA = PB_9,
SPI_MOSI = PA_7,
SPI_MISO = PA_6,
SPI_SCK = PA_5,
SPI_CS = PB_6,
PWM_OUT = PB_3,
// Not connected
NC = 0xFFFFFFFF,
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProviders/GpioProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152.HardwareModel.HardwareProviders
{
using Chipset = CortexM3OnMBED;
public sealed class GpioProvider : Chipset.HardwareModel.GpioProvider
{
public override int GetGpioPinIRQNumber(int pinNumber)
{
int pinIndex = pinNumber % 16;
switch (pinIndex)
{
case 0:
return (int)IRQn.EXTI0_IRQn;
case 1:
return (int)IRQn.EXTI1_IRQn;
case 2:
return (int)IRQn.EXTI2_IRQn;
case 3:
return (int)IRQn.EXTI3_IRQn;
case 4:
return (int)IRQn.EXTI4_IRQn;
case 5:
case 6:
case 7:
case 8:
case 9:
return (int)IRQn.EXTI9_5_IRQn;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
return (int)IRQn.EXTI15_10_IRQn;
default:
throw new System.InvalidOperationException();
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProviders/I2cProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class I2cProvider : Chipset.HardwareModel.I2cProvider
{
public static readonly I2cChannelInfo I2C0 = new I2cChannelInfo()
{
SdaPin = (int)PinName.PB_9,
SclPin = (int)PinName.PB_8,
PortIndex = 0,
};
public static readonly I2cChannelInfo I2C1 = new I2cChannelInfo()
{
SdaPin = (int)PinName.PB_10,
SclPin = (int)PinName.PB_6,
PortIndex = 1,
};
public override I2cChannelInfo GetI2cChannelInfo(int id)
{
switch (id)
{
case 0:
return I2C0;
case 1:
return I2C1;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProviders/SpiProvider.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class SpiProvider : Chipset.HardwareModel.SpiProvider
{
public static readonly SpiChannelInfo SPI0 = new SpiChannelInfo() {
Mosi = (int)PinName.PA_7,
Miso = (int)PinName.PA_6,
Sclk = (int)PinName.PA_5,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 0,
HoldTime = 0,
ActiveLow = true,
};
public static readonly SpiChannelInfo SPI1 = new SpiChannelInfo()
{
Mosi = (int)PinName.PB_5,
Miso = (int)PinName.PB_4,
Sclk = (int)PinName.PB_3,
DefaultChipSelect = unchecked((int)PinName.NC),
SetupTime = 10,
HoldTime = 10,
ActiveLow = true,
};
public override bool SpiBusySupported
{
get
{
return true;
}
}
public override SpiChannelInfo GetSpiChannelInfo(int id)
{
switch (id)
{
case 0:
return SPI0;
case 1:
return SPI1;
default:
return null;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProvidersUwp/AdcProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class AdcProviderUwp : Microsoft.Zelig.Runtime.AdcProviderUwp
{
private static readonly AdcChannelInfoUwp m_adcInfo = new AdcChannelInfoUwp()
{
MaxValue = UInt16.MaxValue,
MinValue = 0,
ResolutionInBits = 16,
AdcPinNumbers = new int[] {(int)PinName.A0, (int)PinName.A1, (int)PinName.A2, (int)PinName.A3, (int)PinName.A4, (int)PinName.A5 }
};
public override AdcChannelInfoUwp GetAdcChannelInfo()
{
return m_adcInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProvidersUwp/I2cProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class I2cProviderUwp : Microsoft.Zelig.Runtime.I2cProviderUwp
{
private static string[] m_i2cChannels = { "I2C0", "I2C1" };
public override I2cChannelInfo GetI2cChannelInfo(string busId)
{
switch (busId)
{
case "I2C0":
return I2cProvider.I2C0;
case "I2C1":
return I2cProvider.I2C1;
default:
return null;
}
}
public override string[] GetI2cChannels()
{
return m_i2cChannels;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProvidersUwp/PwmProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class PwmProviderUwp : Microsoft.Zelig.Runtime.PwmProviderUwp
{
private static readonly PwmChannelInfoUwp m_pwmInfo = new PwmChannelInfoUwp()
{
MaxFrequency = 1000000,
MinFrequency = 0,
PwmPinNumbers = new int[]
{
(int)PinName.D0,
(int)PinName.D1,
(int)PinName.D3,
(int)PinName.D4,
(int)PinName.D5,
(int)PinName.D6,
(int)PinName.D9,
(int)PinName.D10,
(int)PinName.D11,
(int)PinName.D12,
(int)PinName.D13,
}
};
public override PwmChannelInfoUwp GetPwmChannelInfo()
{
return m_pwmInfo;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/HardwareProvidersUwp/SpiProviderUwp.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using System;
using Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using ChipsetAbstration = Microsoft.DeviceModels.Chipset.CortexM3;
public sealed class SpiProviderUwp : Microsoft.Zelig.Runtime.SpiProviderUwp
{
private static readonly string[] m_spiDevices = { "SPI0", "SPI1" };
public static readonly SpiChannelInfoUwp SPI0 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI0,
};
public static readonly SpiChannelInfoUwp SPI1 = new SpiChannelInfoUwp()
{
ChipSelectLines = 1,
MinFreq = 1000,
MaxFreq = 30000000,
Supports16 = true,
ChannelInfoKernel = SpiProvider.SPI1,
};
public override SpiChannelInfoUwp GetSpiChannelInfo(string busId)
{
switch (busId)
{
case "SPI0":
return SPI0;
case "SPI1":
return SPI1;
default:
return null;
}
}
public override string[] GetSpiChannels()
{
return m_spiDevices;
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/NVIC.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
enum IRQn
{
/****** Cortex-M3 Processor Exceptions Numbers ******************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */
UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */
SVC_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */
PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
/****** STM32L specific Interrupt Numbers ***********************************************************/
WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
TAMPER_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */
RTC_WKUP_IRQn = 3, /*!< RTC Wakeup Timer through EXTI Line Interrupt */
FLASH_IRQn = 4, /*!< FLASH global Interrupt */
RCC_IRQn = 5, /*!< RCC global Interrupt */
EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 global Interrupt */
DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 global Interrupt */
DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 global Interrupt */
DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 global Interrupt */
DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 global Interrupt */
DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 global Interrupt */
DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 global Interrupt */
ADC1_IRQn = 18, /*!< ADC1 global Interrupt */
USB_HP_IRQn = 19, /*!< USB High Priority Interrupt */
USB_LP_IRQn = 20, /*!< USB Low Priority Interrupt */
DAC_IRQn = 21, /*!< DAC Interrupt */
COMP_IRQn = 22, /*!< Comparator through EXTI Line Interrupt */
EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
LCD_IRQn = 24, /*!< LCD Interrupt */
TIM9_IRQn = 25, /*!< TIM9 global Interrupt */
TIM10_IRQn = 26, /*!< TIM10 global Interrupt */
TIM11_IRQn = 27, /*!< TIM11 global Interrupt */
TIM2_IRQn = 28, /*!< TIM2 global Interrupt */
TIM3_IRQn = 29, /*!< TIM3 global Interrupt */
TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
USART1_IRQn = 37, /*!< USART1 global Interrupt */
USART2_IRQn = 38, /*!< USART2 global Interrupt */
USART3_IRQn = 39, /*!< USART3 global Interrupt */
EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
RTC_Alarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
USB_FS_WKUP_IRQn = 42, /*!< USB FS WakeUp from suspend through EXTI Line Interrupt */
TIM6_IRQn = 43, /*!< TIM6 global Interrupt */
TIM7_IRQn = 44, /*!< TIM7 global Interrupt */
TIM5_IRQn = 46, /*!< TIM5 global Interrupt */
SPI3_IRQn = 47, /*!< SPI3 global Interrupt */
UART4_IRQn = 48, /*!< UART4 global Interrupt */
UART5_IRQn = 49, /*!< UART5 global Interrupt */
DMA2_Channel1_IRQn = 50, /*!< DMA2 Channel 1 global Interrupt */
DMA2_Channel2_IRQn = 51, /*!< DMA2 Channel 2 global Interrupt */
DMA2_Channel3_IRQn = 52, /*!< DMA2 Channel 3 global Interrupt */
DMA2_Channel4_IRQn = 53, /*!< DMA2 Channel 4 global Interrupt */
DMA2_Channel5_IRQn = 54, /*!< DMA2 Channel 5 global Interrupt */
COMP_ACQ_IRQn = 56, /*!< Comparator Channel Acquisition global Interrupt */
LAST = 57,
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Peripherals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ALLOW_PAUSE
namespace Microsoft.Llilum.STM32L152
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
using CMSIS = Microsoft.DeviceModels.Chipset.CortexM;
public sealed class Peripherals : Chipset.Peripherals
{
public override void Initialize()
{
base.Initialize( );
//
// Peripherals exceptions all have same priority
//
for(int i = 0; i < (int)IRQn.LAST; ++i)
{
CMSIS.NVIC.SetPriority( i , RT.TargetPlatform.ARMv7.ProcessorARMv7M.c_Priority__GenericPeripherals );
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/HardwareModel/Processor.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using RT = Microsoft.Zelig.Runtime;
using ChipsetModel = Microsoft.CortexM3OnMBED;
public sealed class Processor : Microsoft.CortexM3OnMBED.Processor
{
[RT.ProductFilter("Microsoft.Llilum.BoardConfigurations.STM32L152")]
public new class Context : ChipsetModel.Processor.Context
{
public Context(RT.ThreadImpl owner) : base(owner)
{
}
}
//
// Helper methods
//
[RT.Inline]
public override RT.Processor.Context AllocateProcessorContext(RT.ThreadImpl owner)
{
return new Context(owner);
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("STM32L152")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("STM32L152")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f0229144-f7c4-4456-8442-5e816c6e8fbc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/STM32L152.csproj
================================================
Debug
AnyCPU
{F0229144-F7C4-4456-8442-5E816C6E8FBC}
Library
Properties
Microsoft.Llilum.STM32L152
STM32L152
v4.5
512
true
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\bin\$(Configuration)\
$(LlilumBuildRoot)\Target\obj\$(MSBuildProjectName)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\
$(LLILUM_SDK)\ZeligBuild\Target\obj\$(MSBuildProjectName)\
true
full
false
DEBUG;TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
TRACE
prompt
4
true
true
true
AllRules.ruleset
AnyCPU
false
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{b8fe271a-cd41-435e-8766-4db7609c1007}
CortexM0OnCMSIS-Core
{89ebdbb0-c81f-4611-b719-b385df215f8d}
CortexM0OnMBED
{0b37e5ba-4839-4ec4-9e36-a96bcbea2400}
CortexM3OnCMSIS-Core
{0c522c6a-0f77-4af8-ad78-5b2415c98c51}
CortexM3OnMBED
{c3bfafad-a6c6-471d-a059-b3cb7e57a4ab}
ModelForCortexM0
{a30eb003-94f8-4a85-8da1-006f6810a7a4}
ModelForCortexM3
{e4c618af-1785-472e-a070-8068e20582eb}
ModelForCortexM
{186f31a3-ef89-4a25-b2d5-20070601aa01}
CommonPC
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186f31a3-ef89-4a25-b2d5-20060509aa01}
Kernel
{20dc2cf5-8eed-4231-9743-6bab96be465c}
LlilumOSAbstraction
{186f31a3-ef89-4a25-b2d5-20060720aa01}
TypeSystem
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM0.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM0OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM0OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnCMSISCore.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.CortexM3OnMBED.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.DeviceModels.ModelForCortexM3.dll
False
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\Microsoft.Zelig.LlilumOSAbstraction.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.ProductConfiguration.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.Common.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.CommonPC.dll
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\$(Configuration)\Microsoft.Zelig.Runtime.TypeSystem.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\$(Configuration)\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/SystemServices/GarbageCollectionManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using Chipset = Microsoft.CortexM3OnMBED;
public sealed class GarbageCollectionManager : Chipset.GarbageCollectionManager
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/SystemServices/ThreadManager.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using RT = Microsoft.Zelig.Runtime;
using Chipset = Microsoft.CortexM3OnMBED;
public sealed class ThreadManager : Chipset.ThreadManager
{
private const int DefaultStackSizeSTM32L152 = (4 * 512) / sizeof( uint );
//--//
//
// Helper Methods
//
public override int DefaultStackSize
{
get
{
return DefaultStackSizeSTM32L152;
}
}
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Board/SystemServices/TimerPool.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.STM32L152
{
using Chipset = Microsoft.CortexM3OnMBED;
public sealed class TimerPool : Chipset.TimerPool
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("STM32L152")]
public sealed class STM32L152SoC : ProcessorCategory
{
[DependsOn(typeof(STM32L152SoC))]
[DisplayName("Internal 80KB Static RAM")]
[Defaults("BaseAddress", 0x20000000)]
[Defaults("SizeInBytes", 80 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.RAM |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalRAM80KB : RamMemoryCategory
{
}
[DependsOn(typeof(STM32L152SoC))]
[DisplayName("Internal 512KB FLASH")]
[Defaults("BaseAddress", 0x00000000)]
[Defaults("SizeInBytes", 512 * 1024)]
[Defaults("WordSize", 32)]
[Defaults("WaitStates", 0)]
[EnumDefaults("Characteristics", MemoryAttributes.FLASH |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.InternalMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
public sealed class InternalFlash512KB : FlashMemoryCategory
{
}
}
//--//
//--//
//--//
[DisplayName("Memory Map for STM32L152")]
public sealed class STM32L152MemoryMap : MemoryMapCategory
{
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint)]
[MemorySection(MemoryUsage.Stack |
MemoryUsage.Heap |
MemoryUsage.DataRW |
MemoryUsage.Code)]
[AllowedOptions(typeof(STM32L152SoC.InternalRAM80KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRamChip;
[MergeEnumDefaults("Characteristics", MemoryAttributes.InternalMemory |
MemoryAttributes.RandomAccessMemory |
MemoryAttributes.ConfiguredAtEntryPoint |
MemoryAttributes.LoadedAtEntrypoint)]
[MemorySection(MemoryUsage.Bootstrap |
MemoryUsage.Code |
MemoryUsage.DataRO |
MemoryUsage.VectorsTable |
MemoryUsage.Relocation)]
[AllowedOptions(typeof(STM32L152SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x00000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("STM32L152 MBED")]
public sealed class STM32L152 : ProductCategory
{
[AllowedOptions(typeof(STM32L152SoC))]
[Defaults("CoreClockFrequency", 32000000UL)]
[Defaults("RealTimeClockFrequency", 1000000UL)]
public STM32L152SoC Processor;
//--//
[AllowedOptions(typeof(STM32L152SoC.InternalRAM80KB))]
[Defaults("BaseAddress", 0x20000000U)]
public RamMemoryCategory InternalRam;
[AllowedOptions(typeof(STM32L152SoC.InternalFlash512KB))]
[Defaults("BaseAddress", 0x00000000U)]
public FlashMemoryCategory InternalFlashChip;
}
//--//
//--//
//--//
[DisplayName("LLVM Compilation for STM32L152")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7M))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(STM32L152))]
[Defaults("MemoryMap", typeof(STM32L152MemoryMap))]
public sealed class STM32L152MBEDCompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.STM32L152")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f222e0d3-0fff-41f4-91ee-400c4e4e043d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Configuration/STM32L152.FrontEndConfig
================================================
###
### NOTE: This file can be used in the SDK AS-IS, or remove all instances of #~# to use as manual input for the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
-Architecture cortex-m3
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.STM32L152.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.STM32L152MBEDCompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.CortexM3OnMBED
-Reference Microsoft.CortexM3OnCMSISCore
-Reference Microsoft.DeviceModels.ModelForCortexM3
-Reference STM32L152
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
###
### Dumps and diagnostics
###
#-DumpIRBeforePhase All
-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
#-DumpFlattenedCallGraph
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#~#-NoSDK
-GenerateObj
# examples of overriding opt.exe and llc arguments
# the examples here are the same as the defaults but can be modified to suit a variety of test
# scenarios and experimentations
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
# While the compiler is pretty good at figuring out where the LLVM tools are from
# current Environment variables or registry entires you can manually specify the
# path to find the LLVM binaries.
# note: Environment variabes (i.e %MY_VAR%) are supported and expanded as with all
# options in the FrontendConfig files so you can specify a custom variable if needed
#-LlvmBinPath \\netmfbld02\LLVM\3.7.0\build\Win32\Release\bin
================================================
FILE: Zelig/BoardConfigurations/STM32L152/Configuration/STM32L152Configuration.csproj
================================================
Debug
AnyCPU
{F222E0D3-0FFF-41F4-91EE-400C4E4E043D}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.STM32L152
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/BoardConfigurations/Win32/Configuration/Configuration.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Llilum.BoardConfigurations
{
using Microsoft.Zelig.Configuration.Environment;
[DisplayName("Win32Product")]
public sealed class Win32Product : ProductCategory
{
[Defaults("CoreClockFrequency", 1000UL)]
[Defaults("RealTimeClockFrequency", 1000UL)]
[Defaults("DefaultThreadPoolThreads", 10)]
[Defaults("DefaultTimerPoolThreads" , 10)]
public ProcessorCategory Processor;
}
[DisplayName("Memory Map for Win32")]
public sealed class Win32CoreMemoryMap : MemoryMapCategory
{
}
[DisplayName("LLVM Compilation for Win32")]
[Defaults("Platform", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForWin32))]
[Defaults("CallingConvention", typeof(Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.LlvmForArmV7MCallingConvention))]
[Defaults("Product", typeof(Win32Product))]
[Defaults("MemoryMap", typeof(Win32CoreMemoryMap))]
public sealed class Win32CompilationSetup : CompilationSetupCategory
{
}
}
================================================
FILE: Zelig/BoardConfigurations/Win32/Configuration/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Llilum.BoardConfigurations.K26")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.Llilum.BoardConfigurations.K26")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("63BB92A6-10A4-42A2-BB1F-FC645ECAC716")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: Zelig/BoardConfigurations/Win32/Configuration/Win32.FrontEndConfig
================================================
###
### README: This file can be used in the SDK AS-IS, or remove all instances of #~# to use with the FrontEnd project
###
###
### Location of the Zelig assemblies.
###
#~#-HostAssemblyDir ..\..\..\..\ZeligBuild\Host\bin\Debug
#~#-DeviceAssemblyDir ..\..\..\..\ZeligBuild\Target\bin\Debug
#~#-CompilationSetupPath ..\..\..\..\ZeligBuild\Host\bin\Debug\Microsoft.Llilum.BoardConfigurations.K26.dll
-CompilationSetup Microsoft.Llilum.BoardConfigurations.K26CompilationSetup
###
### We need to include this assembly to get the right drivers.
###
-Reference Microsoft.DeviceModels.ModelForWin32
-Reference Win32
###
### Add compilation phases, in order
###
#-CompilationPhaseDisabled ReduceNumberOfTemporaries
#-CompilationPhaseDisabled TransformFinallyBlocksIntoTryBlocks
#-CompilationPhaseDisabled ApplyClassExtensions
#-CompilationPhaseDisabled PrepareImplementationOfInternalMethods
#-CompilationPhaseDisabled CrossReferenceTypeSystem
#-CompilationPhaseDisabled ApplyConfigurationSettings
-CompilationPhaseDisabled ResourceManagerOptimizations
#-CompilationPhaseDisabled HighLevelTransformations
#-CompilationPhaseDisabled PropagateCompilationConstraints
#-CompilationPhaseDisabled ComputeCallsClosure
#-CompilationPhaseDisabled EstimateTypeSystemReduction
#-CompilationPhaseDisabled CompleteImplementationOfInternalMethods
#-CompilationPhaseDisabled ReduceTypeSystem
-CompilationPhaseDisabled PrepareExternalMethods
#-CompilationPhaseDisabled DetectNonImplementedInternalCalls
#-CompilationPhaseDisabled OrderStaticConstructors
#-CompilationPhaseDisabled LayoutTypes
#-CompilationPhaseDisabled HighLevelToMidLevelConversion
#-CompilationPhaseDisabled FromImplicitToExplicitExceptions
#-CompilationPhaseDisabled ReferenceCountingGarbageCollection
-CompilationPhaseDisabled MidLevelToLowLevelConversion
-CompilationPhaseDisabled ConvertUnsupportedOperatorsToMethodCalls
-CompilationPhaseDisabled ExpandAggregateTypes
-CompilationPhaseDisabled SplitComplexOperators
-CompilationPhaseDisabled FuseOperators
#-CompilationPhaseDisabled Optimizations
-CompilationPhaseDisabled ConvertToSSA
-CompilationPhaseDisabled PrepareForRegisterAllocation
-CompilationPhaseDisabled CollectRegisterAllocationConstraints
-CompilationPhaseDisabled AllocateRegisters
#-CompilationPhaseDisabled GenerateImage
#-CompilationPhaseDisabled Done
###
### The program to compile.
###
#~#..\..\..\..\ZeligBuild\Target\bin\Debug\Microsoft.Zelig.Test.mbed.Simple.exe
###
### Where to put the results.
###
#~#-OutputName Microsoft.Zelig.Test.mbed.Simple
#~#-OutputDir ..\..\..\..\LLVM2IR_results\mbed\simple
#-DumpIR
#-DumpIRpre
#-DumpIRpost
#-DumpIRXML
-DumpLLVMIR
#-ReloadState
#-DumpLLVMIR_TextRepresentation
-MaxProcs 8
#-NoSDK
#-GenerateObj
#-LlvmOptArgs "-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse"
#-LlvmLlcArgs "-O2 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=thumbv7m-none-eabi"
================================================
FILE: Zelig/BoardConfigurations/Win32/Configuration/Win32Configuration.csproj
================================================
Debug
AnyCPU
{F84C2434-C768-4295-955B-E032E3A18FC3}
Library
Properties
Microsoft.Llilum.BoardConfigurations
Microsoft.Llilum.BoardConfigurations.Win32
v4.5
512
true
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
{186f31a3-ef89-4a25-b2d5-20070606aa01}
ProductConfiguration
{186f31a3-ef89-4a25-b2d5-20061218aa01}
Common
{186F31A3-EF89-4A25-B2D5-20060501AA01}
mscorlib
False
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.ProductConfiguration.dll
$(LLILUM_SDK)\ZeligBuild\Host\bin\Debug\Microsoft.Zelig.Runtime.Common.dll
$(LLILUM_SDK)\ZeligBuild\Target\bin\Debug\mscorlib.dll
================================================
FILE: Zelig/LLVM2IR_results/mbed/common_files/temporary_helper.c
================================================
#include "gpio_api.h"
#include
void tmp_gpio_write(gpio_t *obj, int value)
{
gpio_write(obj,value);
}
int tmp_gpio_read(gpio_t *obj)
{
return gpio_read(obj);
}
void tmp_gpio_alloc(gpio_t **obj)
{
*obj=calloc(sizeof(gpio_t),1);
}
================================================
FILE: Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/Makefile
================================================
# This file was automagically generated by mbed.org. For more information,
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
VERBOSE=1
ifndef GCC_BIN
$(error GCC_BIN is undefined. Define GCC_BIN to point to arm-none-eabi-xxx tools)
endif
# Common settings
PROJECT = GpioInterrupt
MBED_ROOT = $(LLILUM_ROOT)Zelig\mbed
MBED_RTOS_ROOT = $(LLILUM_ROOT)Zelig\mbed-rtos
SOURCE_ROOT = $(LLILUM_ROOT)Zelig\LLVM2IR_results\mbed\mbed_rtos\GpioInterrupts
LIBRARIES = -lmbed
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
ifeq ($(TARGET),)
$(error TARGET is undefined. Pass in TARGET for desired board)
endif
ifeq ($(TARGET),LPC1768)
OBJECTS = $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M3\TOOLCHAIN_GCC\HAL_CM3.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M3\TOOLCHAIN_GCC\SVC_Table.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\HAL_CM.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\RTX_Conf_CM.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_CMSIS.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Event.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_List.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Mailbox.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_MemBox.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Mutex.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Robin.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Semaphore.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_System.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Task.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Time.o $(TARGET)\main.o $(MBED_RTOS_ROOT)\rtos\Mutex.o $(MBED_RTOS_ROOT)\rtos\RtosTimer.o $(MBED_RTOS_ROOT)\rtos\Semaphore.o $(MBED_RTOS_ROOT)\rtos\Thread.o
SYS_OBJECTS = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\board.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\cmsis_nvic.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\retarget.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\startup_LPC17xx.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\system_LPC17xx.o
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(MBED_RTOS_ROOT) -I$(MBED_RTOS_ROOT)\rtos -I$(MBED_RTOS_ROOT)\rtx -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M3 -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M3\TOOLCHAIN_GCC -I$(SOURCE_ROOT) -I$(MBED_ROOT)\TARGET_LPC1768 -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768 -I$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM
LIBRARY_PATHS = -L$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\LPC1768.ld
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -DARM_MATH_CM3 -DMBED_BUILD_TIMESTAMP=1446568245.6 -DTARGET_CORTEX_M -DTARGET_LPC176X -DTARGET_NXP -DTARGET_MBED_LPC1768 -DTARGET_LPC1768 -D__CORTEX_M3 -DTARGET_M3 -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=${TARGET}\$(PROJECT).map,--cref
else ifeq ($(TARGET),K64F)
OBJECTS = $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M4\TOOLCHAIN_GCC\HAL_CM4.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M4\TOOLCHAIN_GCC\SVC_Table.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\HAL_CM.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\RTX_Conf_CM.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_CMSIS.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Event.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_List.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Mailbox.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_MemBox.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Mutex.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Robin.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Semaphore.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_System.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Task.o $(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\rt_Time.o $(TARGET)\main.o $(MBED_RTOS_ROOT)\rtos\Mutex.o $(MBED_RTOS_ROOT)\rtos\RtosTimer.o $(MBED_RTOS_ROOT)\rtos\Semaphore.o $(MBED_RTOS_ROOT)\rtos\Thread.o
SYS_OBJECTS = $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\board.o $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\cmsis_nvic.o $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\mbed_overrides.o $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\retarget.o $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\startup_MK64F12.o $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\system_MK64F12.o
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(MBED_RTOS_ROOT) -I$(MBED_RTOS_ROOT)\rtos -I$(MBED_RTOS_ROOT)\rtx -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M4 -I$(MBED_RTOS_ROOT)\rtx\TARGET_CORTEX_M\TARGET_M4\TOOLCHAIN_GCC -I$(SOURCE_ROOT) -I$(MBED_ROOT)\TARGET_K64F -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\common -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\common\phyksz8081 -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers\clock -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers\enet -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers\interrupt -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers\pit -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\drivers\pit\common -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\adc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\can -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\dac -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\dmamux -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\dspi -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\edma -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\enet -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\flextimer -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\gpio -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\i2c -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\llwu -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\lptmr -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\lpuart -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\mcg -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\mpu -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\osc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\pdb -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\pit -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\pmc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\port -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\rcm -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\rtc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\sai -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\sdhc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\sim -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\smc -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\uart -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\hal\wdog -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_KPSDK_CODE\utilities -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\MK64F12 -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\TARGET_FRDM -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\device -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\device\MK64F12 -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\device\device -I$(MBED_ROOT)\TARGET_K64F\TARGET_Freescale\TARGET_KPSDK_MCUS\TARGET_MCU_K64F\device\device\MK64F12 -I$(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM
LIBRARY_PATHS = -L$(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_K64F\TOOLCHAIN_GCC_ARM\K64FN1M0xxx12.ld
ifeq ($(HARDFP),1)
FLOAT_ABI = hard
else
FLOAT_ABI = softfp
endif
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_KPSDK_MCUS -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -DCPU_MK64FN1M0VMD12 -DTARGET_FRDM -DTARGET_CORTEX_M -DMBED_BUILD_TIMESTAMP=1446571491.65 -D__FPU_PRESENT=1 -DTARGET_KPSDK_CODE -DTARGET_M4 -D__MBED__=1 -DTARGET_K64F -DTARGET_Freescale -D__CORTEX_M4 -DFSL_RTOS_MBED -DTARGET_MCU_K64F -DARM_MATH_CM4
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=${TARGET}\$(PROJECT).map,--cref
else
$(error TARGET is not recognized. Please check the value passed in)
endif
DEPS = $(OBJECTS:.o=.d)
###############################################################################
AS = $(GCC_BIN)arm-none-eabi-as
CC = $(GCC_BIN)arm-none-eabi-gcc
CPP = $(GCC_BIN)arm-none-eabi-g++
LD = $(GCC_BIN)arm-none-eabi-gcc
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
SIZE = $(GCC_BIN)arm-none-eabi-size
ifeq ($(DEBUG), 1)
CC_FLAGS += -DDEBUG -O0
else
CC_FLAGS += -DNDEBUG -Os
endif
.PHONY: all clean lst size
all: ${TARGET} ${TARGET}\$(PROJECT).bin ${TARGET}\$(PROJECT).hex $(TARGET)\$(PROJECT).lst $(TARGET)\$(PROJECT).disasm size
clean: ${TARGET}
@rmdir /q /s $(TARGET)
# Ensures the target directory has been created.
${TARGET}:
@mkdir $@
$(TARGET)\\%.o : %.asm
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o : %.S
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o : %.s
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o : %.c
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o : $(SOURCE_ROOT)\%.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
$(TARGET)\$(PROJECT).bin: $(TARGET)\$(PROJECT).elf
$(OBJCOPY) -O binary $< $@
$(TARGET)\$(PROJECT).hex: $(TARGET)\$(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@
$(TARGET)\$(PROJECT).lst: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@
$(TARGET)\$(PROJECT).disasm: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -D $< > $@
size: $(TARGET)\$(PROJECT).elf
@echo Size report...
$(SIZE) $<
#DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
#-include $(DEPS)
================================================
FILE: Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/buildK64F.bat
================================================
@echo off
make TARGET=K64F %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/buildLPC1768.bat
================================================
@echo off
make TARGET=LPC1768 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/mbed_rtos/GpioInterrupts/main.cpp
================================================
#include "mbed.h"
#include "rtos.h"
#include "Thread.h"
//
// To test hardware generated interrupt handling comment out this #define and connect a function generator to the input pin
// (LPC1768: p9, K64F: PTC7). Also place a oscilloscope probe on the monitor pin (LPC1768: p11, K64F: PTC0).
//
#define TEST_SOFTWARE_INTERRUPTS 1
#if TARGET_LPC1768
#if TEST_SOFTWARE_INTERRUPTS
DigitalOut pinOut(P0_1);
#endif
InterruptIn pinIn(P0_0);
DigitalOut pinMonitor(P0_18);
#elif TARGET_K64F
#if TEST_SOFTWARE_INTERRUPTS
DigitalOut pinOut(PTC5);
#endif
InterruptIn pinIn(PTC7);
DigitalOut pinMonitor(PTC0);
#else
!Error No target defined.
#endif
const int SIGNAL_MAIN_THREAD = 0x4321;
const int SIGNAL_DISPATCH_THREAD = 0x1234;
const int SIGNAL_WAIT_FOREVER = 0x1000;
struct Dispatcher;
Mutex dispatcher_lock;
Mutex gpio_lock;
Dispatcher *s_pDispatcherInst = NULL;
Queue gpio_interrupt_queue;
Thread *p_main_thread = NULL;
Thread *p_dispatcher_thread = NULL;
#if !TEST_SOFTWARE_INTERRUPTS
int g_monitor_value = 1;
#endif
void main_thread_proc(void const *args);
void dispatcher_thread_proc(void const *args);
typedef void (*PIN_CHANGED_HANDLER)(int edge);
void handle_event(int event)
{
#if TEST_SOFTWARE_INTERRUPTS
pinMonitor = 0;
p_main_thread->signal_set(SIGNAL_MAIN_THREAD);
#else
pinMonitor = g_monitor_value;
g_monitor_value = !g_monitor_value;
#endif
}
struct Dispatcher
{
static Mutex m_lock;
PIN_CHANGED_HANDLER m_callback;
void RegisterForCallback( PIN_CHANGED_HANDLER callback )
{
m_callback = callback;
}
PIN_CHANGED_HANDLER GetCallback()
{
return m_callback;
}
static Dispatcher *GetInstance()
{
if( s_pDispatcherInst == NULL )
{
dispatcher_lock.lock();
if( s_pDispatcherInst == NULL )
{
s_pDispatcherInst = new Dispatcher();
}
dispatcher_lock.unlock();
}
return s_pDispatcherInst;
}
static void dispatcher_thread_proc(void const *args)
{
while(p_main_thread == NULL)
{
wait(1.0);
}
p_main_thread->signal_set(SIGNAL_MAIN_THREAD);
while (true)
{
Thread::signal_wait(SIGNAL_DISPATCH_THREAD);
gpio_lock.lock();
osEvent evt = gpio_interrupt_queue.get();
gpio_lock.unlock();
Dispatcher *pInst = Dispatcher::GetInstance();
PIN_CHANGED_HANDLER callback = pInst->GetCallback();
if( callback != NULL)
{
callback((int)evt.value.p);
}
}
}
};
void OnRise(void)
{
int evt = pinIn;
gpio_lock.lock();
gpio_interrupt_queue.put((int*)evt);
gpio_lock.unlock();
p_dispatcher_thread->signal_set(SIGNAL_DISPATCH_THREAD);
}
void main_thread_proc(void const *args)
{
Thread::signal_wait(SIGNAL_MAIN_THREAD);
pinMonitor = 0;
#if TEST_SOFTWARE_INTERRUPTS
pinOut = 0;
#else
pinIn.fall( &OnRise );
#endif
pinIn.rise( &OnRise );
while(1)
{
#if TEST_SOFTWARE_INTERRUPTS
pinMonitor = 1;
pinOut = 1;
#endif
Thread::signal_wait(SIGNAL_MAIN_THREAD);
#if TEST_SOFTWARE_INTERRUPTS
pinOut = 0;
wait(2.0);
#endif
}
}
int main()
{
Dispatcher *pDisp = Dispatcher::GetInstance();
pDisp->RegisterForCallback( handle_event );
Thread dispatcher_thread(Dispatcher::dispatcher_thread_proc);
Thread main_thread(main_thread_proc);
p_dispatcher_thread = &dispatcher_thread;
p_main_thread = &main_thread;
Thread::signal_wait(SIGNAL_WAIT_FOREVER);
}
================================================
FILE: Zelig/LLVM2IR_results/mbed/mbed_rtos/ReadMe.txt
================================================
The applications under this directory require the mbed-rtos directories that can be found at https://developer.mbed.org/users/mbed_official/code/mbed-rtos/.
The following subdirectories of mbed-rtos are required:
* rtos
* rtx\TARGET_CORTEX_M
* rtx\TARGET_CORTEX_M\TARGET_M3\...
* rtx\TARGET_CORTEX_M\TARGET_M4\...
The mbed-rtos directory must be placed in the directory $(LLILUM_ROOT)\Zelig\ as a peer directory to $(LLILUM_ROOT)\Zelig\mbed.
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/.gdbinit
================================================
define hook-quit
set confirm off
end
set listsize 10
set filename-display basename
set target-charset ASCII
set output-radix 16
set print address off
set print pretty on
set print symbol off
set print symbol-filename off
set pagination off
set disassemble-next-line on
br DebugLogPrint
commands
silent
printf "DebugLog: %s\n", message
cont
end
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/DebugOptions.xml
================================================
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/build.bat
================================================
@echo off
setlocal enableDelayedExpansion
@REM - Set this ENVIRONMENT Variable to override default optimization level for testing
IF NOT DEFINED LLILUM_OPT_LEVEL SET LLILUM_OPT_LEVEL=2
@REM with the Llilum compiler now running opt and LLC internally the default here
@REM is not to run either one unless explicitly enabled by the user. This essentially
@REM boils down to run the size app to show obj file size info and then running make
@REM to build the native code components and link the final image.
IF NOT DEFINED LLILUM_SKIP_OPT SET LLILUM_SKIP_OPT=1
IF NOT DEFINED LLILUM_SKIP_LLC SET LLILUM_SKIP_LLC=1
IF NOT DEFINED LLILUM_DEBUG SET LLILUM_DEBUG=1
IF NOT DEFINED LLILUM_SKIP_CLEANCLEAN SET LLILUM_SKIP_CLEANCLEAN=1
@REM lwIP stack has binaries for release, checked and debug. Checked is a release build
@REM of lwIP (-Os -DNDEBUG) with LWIP_DEBUG defined and all debug switches for modules turned on.
@REM Flag for release binaries is LLILUM_LWIP_DEBUG=0, debug binaries is 1, and checked is 2.
IF NOT DEFINED LLILUM_LWIP_DEBUG SET LLILUM_LWIP_DEBUG=0
@REM SET incremental build as default, and correct as needed
SET LLILUM_CLEANCLEAN=0
SET LLILUM_DUMPS=0
IF "%2"=="/clean" (
SET LLILUM_CLEANCLEAN=1
)
IF "%2"=="/dumps" (
SET LLILUM_DUMPS=1
)
IF "%3"=="/dumps" (
SET LLILUM_DUMPS=1
)
IF "%LLILUM_SKIP_CLEANCLEAN%" == "0" (
SET LLILUM_CLEANCLEAN=1
)
IF "%LLILUM_CLEANCLEAN%" == "0" (
ECHO Incremental build for c/cpp/asm sources...
ECHO Use 'SET LLILUM_SKIP_CLEANCLEAN=' or 'SET LLILUM_SKIP_CLEANCLEAN=0' to perform a full build,
ECHO or call the build batch file with '/bc' as last argument
)
IF /i "%LLVM_BIN%"=="" (
ECHO LLVM_BIN is not defined. Please define LLVM_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF %1.==. (
ECHO No target passed in. Defaulting to LPC1768
SET TARGET=LPC1768
SET LLILUM_TARGET_CPU=cortex-m3
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET SIZE_OF_HEAP=0x6000
SET LWIP_USE=0
) ELSE (
ECHO Detected target: %1
SET TARGET=%1
IF "%1"=="K64F" (
SET SIZE_OF_HEAP=0x10000
SET LLILUM_TARGET_CPU=cortex-m3
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=1
) ELSE IF "%1"=="LPC1768" (
SET SIZE_OF_HEAP=0x6000
SET LLILUM_TARGET_CPU=cortex-m3
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=0
) ELSE IF "%1"=="STM32F091" (
SET SIZE_OF_HEAP=0x6000
SET LLILUM_TARGET_CPU=cortex-m0
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LWIP_USE=0
) ELSE IF "%1"=="STM32F411" (
SET SIZE_OF_HEAP=0x10000
SET LLILUM_TARGET_CPU=cortex-m4
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=0
) ELSE IF "%1"=="STM32F401" (
SET SIZE_OF_HEAP=0x10000
SET LLILUM_TARGET_CPU=cortex-m4
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=0
) ELSE IF "%1"=="STM32L152" (
SET SIZE_OF_HEAP=0x10000
SET LLILUM_TARGET_CPU=cortex-m3
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=0
) ELSE IF "%1"=="WIN32" (
SET SIZE_OF_HEAP=0x10000
SET LLILUM_TARGET_CPU=x86-64
SET LLILUM_TARGET_TRIPLE=x86_64-pc-windows-msvc
SET LLILUM_TARGET_ARCH=x86
SET LLILUM_TARGET_EXTRA=-function-sections -dwarf-version=3
SET LLILUM_SKIP_LLC=0
SET LWIP_USE=0
) ELSE (
SET SIZE_OF_HEAP=0x6000
SET LLILUM_TARGET_CPU=cortex-m3
SET LLILUM_TARGET_TRIPLE=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF
SET LLILUM_TARGET_ARCH=thumb
SET LWIP_USE=0
)
)
SET ARCH_AND_CPU=-march=%LLILUM_TARGET_ARCH% -mcpu=%LLILUM_TARGET_CPU%
SET OPT_STEPS__VERIFY=-verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info
SET OPT_STEPS__OPTIMIZE=-march=%LLILUM_TARGET_ARCH% -mcpu=%LLILUM_TARGET_CPU% -mem2reg -instcombine -scev-aa -indvars -gvn -globaldce -adce -dce -tailcallopt -instcombine -memcpyopt -scalarrepl -ipconstprop -deadargelim -sccp -dce -die -ipsccp -dce -die -instcombine -constmerge -scev-aa -targetlibinfo -irce -dse -dce -instcombine -argpromotion -adce -instcombine -memcpyopt -globaldce -die -dce -dse -loop-deletion -indvars -loop-simplify -licm -indvars -loop-reduce -mem2reg -time-passes
SET OPT_STEPS__BUILDS_DATA_STRUCTURES=-domfrontier -domtree -intervals -globals-aa -memdep -dce -die -domfrontier -domtree -intervals -globals-aa -memdep
SET OPT_STEPS__SIMPLIFY_GLOBALS=-strip-dead-prototypes -globalopt -globaldce -gvn -prune-eh -reassociate -constmerge -ipconstprop -reassociate -constmerge -constprop -constmerge -sccp -constmerge -deadargelim -ipsccp -irce %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__DEAD_CODE_OBVIOUS=-dse -die %OPT_STEPS__BUILDS_DATA_STRUCTURES%
REM SET OPT_STEPS__INLINE=-always-inline -inline %OPT_STEPS__BUILDS_DATA_STRUCTURES%
REM SET OPT_STEPS__INLINE=-always-inline %OPT_STEPS__BUILDS_DATA_STRUCTURES%
REM SET OPT_STEPS__MERGE_FUNCTIONS=-mergefunc -mergereturn %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__SIMPLIFY_FUNCTIONS=-simplifycfg %OPT_STEPS__BUILDS_DATA_STRUCTURES%
REM SET OPT_STEPS__SIMPLIFY_SINK=-sink %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__SIMPLIFY_TAIL_CALL=-tailcallopt %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__SIMPLIFY_INSTRUCTIONS=-instcombine -sroa -memcpyopt -irce -scalarrepl -scalarrepl-ssa %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__DEAD_CODE_AGGRESSIVE=-adce -bdce %OPT_STEPS__BUILDS_DATA_STRUCTURES%
REM SET OPT_STEPS__LOOPS=-loop-deletion -indvars -loop-simplify -licm -indvars -loop-reduce %OPT_STEPS__BUILDS_DATA_STRUCTURES%
SET OPT_STEPS__MEM2REG=-mem2reg %OPT_STEPS__BUILDS_DATA_STRUCTURES%
@REM - To skip optimizations for testing you can SET this ENVIRONMENT variable, otherwise the optimization will run as normal
IF "%LLILUM_SKIP_OPT%" == "0" (
ECHO Running LLVM Optimization passes...
"%LLVM_BIN%\llvm-dis" %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc
@REM -"%LLVM_BIN%\opt" -O2 -adce -globaldce %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
@REM -"%LLVM_BIN%\opt" -O1 -globalopt -constmerge -adce -globaldce -time-passes %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
ECHO Verify...
"%LLVM_BIN%\opt" %OPT_STEPS__VERIFY% %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_verify.bc
ECHO Optimize...
ECHO Generating LLVM IR source file...
"%LLVM_BIN%\opt" %OPT_STEPS__OPTIMIZE% %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
REM "%LLVM_BIN%\opt" %ARCH_AND_CPU% %OPT_STEPS__DEAD_CODE_OBVIOUS% %OPT_STEPS__SIMPLIFY_GLOBALS% %OPT_STEPS__INLINE% %OPT_STEPS__MERGE_FUNCTIONS% %OPT_STEPS__INLINE% %OPT_STEPS__SIMPLIFY_FUNCTIONS% %OPT_STEPS__SIMPLIFY_SINK% %OPT_STEPS__SIMPLIFY_TAIL_CALL% %OPT_STEPS__SIMPLIFY_INSTRUCTIONS% %OPT_STEPS__LOOPS% %OPT_STEPS__MEM2REG% -time-passes %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_0.bc
REM "%LLVM_BIN%\opt" %ARCH_AND_CPU% %OPT_STEPS__DEAD_CODE_OBVIOUS% %OPT_STEPS__SIMPLIFY_GLOBALS% %OPT_STEPS__INLINE% %OPT_STEPS__MERGE_FUNCTIONS% %OPT_STEPS__INLINE% %OPT_STEPS__SIMPLIFY_FUNCTIONS% %OPT_STEPS__SIMPLIFY_SINK% %OPT_STEPS__SIMPLIFY_TAIL_CALL% %OPT_STEPS__SIMPLIFY_INSTRUCTIONS% %OPT_STEPS__LOOPS% %OPT_STEPS__MEM2REG% -time-passes %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_0.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_1.bc
REM "%LLVM_BIN%\opt" %ARCH_AND_CPU% %OPT_STEPS__DEAD_CODE_OBVIOUS% %OPT_STEPS__SIMPLIFY_GLOBALS% %OPT_STEPS__INLINE% %OPT_STEPS__MERGE_FUNCTIONS% %OPT_STEPS__INLINE% %OPT_STEPS__SIMPLIFY_FUNCTIONS% %OPT_STEPS__SIMPLIFY_SINK% %OPT_STEPS__SIMPLIFY_TAIL_CALL% %OPT_STEPS__SIMPLIFY_INSTRUCTIONS% %OPT_STEPS__LOOPS% %OPT_STEPS__MEM2REG% -time-passes %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_1.bc -o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
REM "%LLVM_BIN%\llvm-dis" %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_0.bc
REM "%LLVM_BIN%\llvm-dis" %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_1.bc
"%LLVM_BIN%\llvm-dis" %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
@echo off
) ELSE (
ECHO Skipping optimization passes...
COPY %TARGET%\Microsoft.Zelig.Test.mbed.Simple.bc %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc 1>NUL
)
@REM -"%LLVM_BIN%\llvm-bcanalyzer" %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt.bc
IF "%LLILUM_SKIP_LLC%" == "0" (
ECHO Generating LLVM IR source file...
ECHO Compiling to %LLILUM_TARGET_ARCH% ^(optimization level %LLILUM_OPT_LEVEL%^)...
"%LLVM_BIN%\llc" -O%LLILUM_OPT_LEVEL% %LLILUM_TARGET_EXTRA% -code-model=small -data-sections -relocation-model=pic -march=%LLILUM_TARGET_ARCH% -mcpu=%LLILUM_TARGET_CPU% -mtriple=%LLILUM_TARGET_TRIPLE% -filetype=obj -o=%TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt.o %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt_2.bc
if %ERRORLEVEL% LSS 0 (
@ECHO ERRORLEVEL=%ERRORLEVEL%
goto :EXIT
)
) ELSE (
ECHO skipping LLC compilation...
)
IF "%1"=="WIN32" (
GOTO :EXIT
)
ECHO Size Report...
"%GCC_BIN%\arm-none-eabi-size.exe" %TARGET%\Microsoft.Zelig.Test.mbed.Simple_opt.o
ECHO.
ECHO Compiling and linking with mbed libs...
IF "%LLILUM_CLEANCLEAN%" == "1" (
ECHO Cleaning target '%TARGET%' for intermediate and final artifacts...
make cleanclean TARGET=%TARGET%
) ELSE (
ECHO Cleaning target '%TARGET%' for final artifacts only...
make clean TARGET=%TARGET%
)
make all TARGET=%TARGET% HEAP_SIZE=%SIZE_OF_HEAP% STACK_SIZE=%SIZE_OF_STACK% USE_LWIP=%LWIP_USE% DEBUG=%LLILUM_DEBUG% LWIP_DEBUG=%LLILUM_LWIP_DEBUG%
ECHO.
ECHO Target '%TARGET%' build is complete.
ECHO.
IF "%LLILUM_DUMPS%" == "1" (
ECHO Creating .lst and .disas files...
make dumps TARGET=%TARGET% HEAP_SIZE=%SIZE_OF_HEAP% STACK_SIZE=%SIZE_OF_STACK% USE_LWIP=%LWIP_USE%
ECHO done!
)
GOTO :EXIT
:EXIT
ECHO.
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildK64F.bat
================================================
@echo off
"%dp~0%build.bat" K64F %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildLPC1768.bat
================================================
@echo off
"%dp~0%build.bat" LPC1768 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildSTM32F091.bat
================================================
@echo off
"%dp~0%build.bat" STM32F091 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildSTM32F401.bat
================================================
@echo off
"%dp~0%build.bat" STM32F401 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildSTM32F411.bat
================================================
@echo off
"%dp~0%build.bat" STM32F411 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildSTM32L152.bat
================================================
@echo off
"%dp~0%build.bat" STM32L152 %*
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildWin32.bat
================================================
@echo off
"%dp~0%build.bat" WIN32
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/buildmake.bat
================================================
@echo off
IF %1.==. (
ECHO No target passed in. Defaulting to LPC1768
set TARGET=LPC1768
set SIZE_OF_HEAP=0x6000
) ELSE (
ECHO Detected target: %1
set TARGET=%1
IF "%1"=="K64F" (
set SIZE_OF_HEAP=0x10000
) ELSE (
set SIZE_OF_HEAP=0x6000
)
)
::make clean TARGET=%TARGET%
make DEBUG=1 TARGET=%TARGET% HEAP_SIZE=%SIZE_OF_HEAP%
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debug.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
ECHO.
ECHO Trying to start pyOCD for Windows
kill pyocd_win.exe
START /I pyocd_win.exe
PAUSE
ECHO.
ECHO Trying to attach to remote target on port 3333
"%GCC_BIN%arm-none-eabi-gdb.exe" %*
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugK64F.bat
================================================
@echo off
"%dp~0%debug.bat" K64F\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugLPC1768.bat
================================================
@echo off
"%dp~0%debug.bat" LPC1768\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugSTM32F091.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%LLILUM_OPENOCD_SCRIPTS%"=="" (
ECHO Path to OpenOCD scripts is not defined. Please run setenv or set LLILUM_OPENOCD_SCRIPTS to point to the correct directory.
GOTO :EXIT
)
ECHO.
ECHO Trying to start OpenOCD for Windows
kill openocd.exe
START /I openocd.exe -f %LLILUM_OPENOCD_SCRIPTS%interface\stlink-v2-1.cfg -f %LLILUM_OPENOCD_SCRIPTS%board\st_nucleo_f0.cfg
PAUSE
ECHO.
ECHO Trying to attach to remote target on port 3333
"%GCC_BIN%arm-none-eabi-gdb.exe" STM32F091\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugSTM32F401.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%LLILUM_OPENOCD_SCRIPTS%"=="" (
ECHO Path to OpenOCD scripts is not defined. Please run setenv or set LLILUM_OPENOCD_SCRIPTS to point to the correct directory.
GOTO :EXIT
)
ECHO.
ECHO Trying to start OpenOCD for Windows
kill openocd.exe
START /I openocd.exe -f %LLILUM_OPENOCD_SCRIPTS%interface\stlink-v2-1.cfg -f %LLILUM_OPENOCD_SCRIPTS%board\st_nucleo_f4.cfg
PAUSE
ECHO.
ECHO Trying to attach to remote target on port 3333
"%GCC_BIN%arm-none-eabi-gdb.exe" STM32F401\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugSTM32F411.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%LLILUM_OPENOCD_SCRIPTS%"=="" (
ECHO Path to OpenOCD scripts is not defined. Please run setenv or set LLILUM_OPENOCD_SCRIPTS to point to the correct directory.
GOTO :EXIT
)
ECHO.
ECHO Trying to start OpenOCD for Windows
kill openocd.exe
START /I openocd.exe -f %LLILUM_OPENOCD_SCRIPTS%interface\stlink-v2-1.cfg -f %LLILUM_OPENOCD_SCRIPTS%board\st_nucleo_f4.cfg
PAUSE
ECHO.
ECHO Trying to attach to remote target on port 3333
"%GCC_BIN%arm-none-eabi-gdb.exe" STM32F411\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/debugSTM32L152.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%LLILUM_OPENOCD_SCRIPTS%"=="" (
ECHO Path to OpenOCD scripts is not defined. Please run setenv or set LLILUM_OPENOCD_SCRIPTS to point to the correct directory.
GOTO :EXIT
)
ECHO.
ECHO Trying to start OpenOCD for Windows
kill openocd.exe
START /I openocd.exe -f %LLILUM_OPENOCD_SCRIPTS%interface\stlink-v2-1.cfg -f %LLILUM_OPENOCD_SCRIPTS%board\st_nucleo_l1.cfg
PAUSE
"%GCC_BIN%arm-none-eabi-gdb.exe" STM32L152\mbed_simple.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deploy.bat
================================================
@ECHO OFF
setlocal enabledelayedexpansion
IF %1.==. (
ECHO No target passed in. Defaulting to LPC1768
set TARGET=LPC1768
) ELSE (
ECHO Detected target: %1
set TARGET=%1
)
SET DEPLOY_DRIVE=e:
IF "%2" NEQ "" (
set DEPLOY_DRIVE=%2
) ELSE IF EXIST "d:\MBED.HTM" (
set DEPLOY_DRIVE=d:
) ELSE IF EXIST "e:\MBED.HTM" (
set DEPLOY_DRIVE=e:
) ELSE IF EXIST "f:\MBED.HTM" (
set DEPLOY_DRIVE=f:
) ELSE IF EXIST "g:\MBED.HTM" (
set DEPLOY_DRIVE=g:
) ELSE IF EXIST "h:\MBED.HTM" (
set DEPLOY_DRIVE=h:
)
IF NOT EXIST %DEPLOY_DRIVE%\ (
@ECHO.
@ECHO Error: device drive not found!
@ECHO.
GOTO :USAGE
)
@ECHO Deleting old image (%DEPLOY_DRIVE%\*.bin) ...
del %DEPLOY_DRIVE%\*.bin
@ECHO Installing new image (%TARGET%\mbed_simple.bin) to %DEPLOY_DRIVE%\...
copy %TARGET%\mbed_simple.bin %DEPLOY_DRIVE%\.
@ECHO Complete!
GOTO :EOF
:USAGE
@ECHO Usage: deploy.bat [DeployDeviceDrive]
@ECHO e.g. 'deploy.bat e:'
@ECHO.
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deployK64F.bat
================================================
deploy.bat K64F
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deployLPC1768.bat
================================================
deploy.bat LPC1768
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deploySTM32F091.bat
================================================
deploy.bat STM32F091
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deploySTM32F401.bat
================================================
deploy.bat STM32F401
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deploySTM32F411.bat
================================================
deploy.bat STM32F411
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/deploySTM32L152.bat
================================================
deploy.bat STM32L152
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/helpers.h
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#include "gpio_api.h"
#ifdef TARGET_LPC1768
#include "core_cm3.h"
#elif TARGET_K64F
#include "core_cm4.h"
#else
#error Undefined plaform
#endif
#include "spi_api.h"
#include "i2c_api.h"
#include "core_cmFunc.h"
#include
#include
#include "us_ticker_api.h"
//
// Platform dependent configurations
//
#ifdef TARGET_LPC1768
#include "system_LPC17xx.h"
#elif TARGET_K64F
#include "system_MK64F12.h"
#else
#error Undefined plaform
#endif
================================================
FILE: Zelig/LLVM2IR_results/mbed/simple/makefile
================================================
#
# Project-specific settings
#
VERBOSE=1
PROJECT = mbed_simple
COMPILE_SYS_ARCH = 1
ifdef USE_LLILUM_OS_ABSTRACTION_STATIC_OBJECT
ifeq ($(DEBUG), 1)
OBJECTS = $(TARGET)\Microsoft.Zelig.Test.mbed.Simple_opt.o \
$(LLILUM_ROOT)\Zelig\ZeligBuild\Target\bin\mbedOsAbstraction\Debug\mbedOSAbstraction_$(TARGET).a
else
OBJECTS = $(TARGET)\Microsoft.Zelig.Test.mbed.Simple_opt.o \
$(LLILUM_ROOT)\Zelig\ZeligBuild\Target\bin\mbedOsAbstraction\Release\mbedOSAbstraction_$(TARGET).a
endif
else
OBJECTS += \
$(TARGET)\Microsoft.Zelig.Test.mbed.Simple_opt.o \
$(TARGET)\mbed_adc.o \
$(TARGET)\mbed_asm.o \
$(TARGET)\mbed_clock.o \
$(TARGET)\mbed_core.o \
$(TARGET)\mbed_debug.o \
$(TARGET)\mbed_gpio.o \
$(TARGET)\mbed_i2c.o \
$(TARGET)\mbed_mem.o \
$(TARGET)\mbed_memory.o \
$(TARGET)\mbed_NVIC.o \
$(TARGET)\mbed_overrides.o \
$(TARGET)\mbed_pwm.o \
$(TARGET)\mbed_serial.o \
$(TARGET)\mbed_spi.o \
$(TARGET)\mbed_system_timer.o \
$(TARGET)\mbed_SysTick.o \
$(TARGET)\mbed_threading.o \
$(TARGET)\mbed_unwind.o \
endif
#
# Paths and includes
# TODO: Make this algorithmic based on TARGET.
#
ifndef GCC_BIN
$(error GCC_BIN is undefined. Define GCC_BIN to point to arm-none-eabi-xxx tools)
endif
ifndef TARGET
$(error TARGET is undefined. Pass in TARGET for desired board)
endif
ifeq ($(HARDFP),1)
FLOAT_ABI = hard
else
FLOAT_ABI = softfp
endif
###################
# General section #
###################
# Common settings
MBED_LIBS = $(LLILUM_ROOT)Zelig
MBED_ROOT = $(LLILUM_ROOT)Zelig\mbed
SOURCE_ROOT = $(LLILUM_ROOT)Zelig\Zelig\Test\mbed\SimpleSDK\Native
LIBRARIES += -lmbed
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(LLILUM_ROOT)Zelig\os_layer\inc -I$(LLILUM_ROOT)Zelig\os_layer\inc\api -I$(LLILUM_ROOT)Zelig\os_layer\inc\api\io -I$(LLILUM_ROOT)Zelig\os_layer\inc\hal
#
# LWIP Compilation and Libraries
#
ifeq ($(USE_LWIP), 1)
# Define lwIP debug flags to build sys_arch libs for both checked and debug builds
ifeq ($(LWIP_DEBUG), 1)
CC_FLAGS += -DLWIP_DEBUG
LIBRARIES += -llwIPd
else ifeq ($(LWIP_DEBUG), 2)
CC_FLAGS += -DLWIP_DEBUG
LIBRARIES += -llwIPc
else
LIBRARIES += -llwIP
endif
# Adaptation layer
ifeq ($(COMPILE_SYS_ARCH),1)
# Used when compiling these objects for the lwipsysarch lib
OBJECTS += $(TARGET)\checksum.o $(TARGET)\memcpy.o $(TARGET)\sys_arch.o
else
# Comment out when compiling this lib
LIBRARIES += -llwipsysarch
endif
OBJECTS += \
$(TARGET)\mbed_ethernet.o \
$(TARGET)\mbed_socket.o \
ifeq ($(TARGET),K64F)
# Ethernet controller
# NOTE: mbed lib is in the back. Order matters, and it needs to be referenced after the lwip libs
LIBRARIES += -lmbedeth -llwIPeth -lmbed
endif
LIBRARY_PATHS += -L$(MBED_LIBS)/lwip/lwip/lib
INCLUDE_PATHS += -I$(MBED_ROOT)/EthernetInterface -I$(MBED_LIBS)\lwip\lwip -I$(MBED_LIBS)\lwip\lwip\include -I$(MBED_LIBS)\lwip\lwip\include\ipv4 -I$(MBED_LIBS)\lwip\lwip\include\ipv4\lwip -I$(MBED_LIBS)\lwip\lwip\include\lwip -I$(MBED_LIBS)\lwip\lwip\include\netif -I$(MBED_LIBS)\lwip\lwip\netif -I$(MBED_LIBS)\lwip/lwip/netif/ppp -I$(MBED_LIBS)\lwip/lwip/api -I$(MBED_LIBS)\lwip/lwip/core -I$(MBED_LIBS)\lwip/lwip/core/ipv4 -I$(MBED_LIBS)\lwip/lwip/core/snmp -I$(MBED_LIBS)\lwip/lwip-eth -I$(MBED_LIBS)\lwip/lwip-eth/arch -I$(MBED_LIBS)\lwip/lwip-sys -I$(MBED_LIBS)\lwip/lwip-sys/arch -I$(MBED_LIBS)\lwip/mbed-rtos/rtos -I$(MBED_LIBS)\lwip/mbed-rtos/llos -I$(MBED_LIBS)/mbed-rtos/llos/TARGET_CORTEX_M
endif
##########################
# Board specific section #
##########################
#
# LPC1768 settings
#
ifeq ($(TARGET),LPC1768)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x6000
CC_FLAGS += -D__HEAP_SIZE=0x6000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
#
# Override defautl stack size for LPC1768 where teh total available RAM is only 32KB
#
ifeq ($(DEBUG), 1)
CC_FLAGS += -D__DEFAULT_STACK_SIZE=0x800
endif
OBJECTS += $(TARGET)\startup_LPC17xx.o
SYS_OBJECTS = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\board.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\cmsis_nvic.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\retarget.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\system_LPC17xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)\TARGET_LPC1768 -I$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768
LIBRARY_PATHS += -L$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\LPC1768.ld
# This is not ready for LPC1768 yet
ifeq ($(USE_LWIP), 1)
INCLUDE_PATHS += -I$(MBED_LIBS)/lwip/lwip-eth/arch/TARGET_NXP
endif
# Build flags
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS += $(CPU) -c -g3 -gdwarf-4 -fvar-tracking-assignments -fno-common -fmessage-length=0 -Wall -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_CORTEX_M -DTARGET_NXP -DTARGET_LPC176X -DTARGET_MBED_LPC1768 -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3 -DMBED_BUILD_TIMESTAMP=1435185689.48 -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
#
# K64F settings
#
else ifeq ($(TARGET),K64F)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x10000
CC_FLAGS += -D__HEAP_SIZE=0x10000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_MK64F12.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/system_MK64F12.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/retarget.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_K64F -I$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common/phyksz8081 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lptmr -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dac -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/gpio -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/port -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/llwu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sim -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rcm -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sdhc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/can -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mpu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/smc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/osc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/flextimer -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pdb -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/i2c -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/uart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dspi -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lpuart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sai -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rtc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mcg -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/edma -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pmc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/wdog -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dmamux -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/utilities -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/interrupt -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock
LIBRARY_PATHS += -L$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld
ifeq ($(USE_LWIP), 1)
INCLUDE_PATHS += -I$(MBED_LIBS)/lwip/lwip-eth/arch/TARGET_Freescale
endif
# Build flags
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS += $(CPU) -c -g3 -gdwarf-4 -fvar-tracking-assignments -fno-common -fmessage-length=0 -Wall -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_K64F -DTARGET_M4 -DTARGET_CORTEX_M -DTARGET_Freescale -DTARGET_KPSDK_MCUS -DTARGET_KPSDK_CODE -DTARGET_MCU_K64F -DTARGET_FRDM -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M4 -DARM_MATH_CM4 -D__FPU_PRESENT=1 -DMBED_BUILD_TIMESTAMP=1435855534.71 -D__MBED__=1 -DCPU_MK64FN1M0VMD12 -DFSL_RTOS_MBED -DTARGET_FF_ARDUINO
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
#
# STM32L152
#
else ifeq ($(TARGET),STM32L152)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x4000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_stm32l152xe.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash_ramfunc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_adc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_adc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_comp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cortex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_crc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cryp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cryp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dac.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dac_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dma.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_smartcard.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_gpio.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_i2c.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_i2s.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_irda.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_iwdg.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_lcd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_nor.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_opamp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_opamp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pcd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pcd_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pwr.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pwr_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rcc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rcc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rtc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rtc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_sd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_spi.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_spi_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_sram.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_tim.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_tim_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_uart.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_usart.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_wwdg.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_ll_fsmc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_ll_sdmmc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/system_stm32l1xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM/TARGET_STM32L1 -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM
LIBRARY_PATHS += -L$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_NUCLEO_L152RE\TOOLCHAIN_GCC_ARM\STM32L152XE.ld
ifeq ($(USE_LWIP), 1)
INCLUDE_PATHS += -I$(MBED_LIBS)/lwip/lwip-eth/arch/TARGET_STM
endif
# Build flags
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DMBED_BUILD_TIMESTAMP=1445629897.99 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -DTARGET_FF_MORPHO -DTARGET_CORTEX_M -DARM_MATH_CM3 -DTARGET_STM32L1 -DTARGET_STM -D__CORTEX_M3 -DTARGET_NUCLEO_L152RE -DTARGET_M3 -DTARGET_STM32L152RE -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
#
# STM32F411
#
else ifeq ($(TARGET),STM32F411)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x10000
CC_FLAGS += -D__HEAP_SIZE=0x10000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_stm32f411xe.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_NUCLEO_F411RE -I$(MBED_ROOT)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_ROOT)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_ROOT)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM
LIBRARY_PATHS += -L$(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld
ifeq ($(USE_LWIP), 1)
INCLUDE_PATHS += -I$(MBED_LIBS)/lwip/lwip-eth/arch/TARGET_STM
endif
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_NUCLEO_F411RE -D__CORTEX_M4 -DTARGET_CORTEX_M -D__FPU_PRESENT=1 -D__MBED__=1 -DTARGET_M4 -DTARGET_FF_MORPHO -DTARGET_STM -DTARGET_STM32F4 -DTOOLCHAIN_GCC -DTARGET_STM32F411RE -DARM_MATH_CM4 -DMBED_BUILD_TIMESTAMP=1450373147.1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
#
# STM32F401
#
else ifeq ($(TARGET),STM32F401)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x10000
CC_FLAGS += -D__HEAP_SIZE=0x6000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_stm32f401xe.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_NUCLEO_F401RE -I$(MBED_ROOT)/TARGET_NUCLEO_F401RE/TARGET_STM -I$(MBED_ROOT)/TARGET_NUCLEO_F401RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_ROOT)/TARGET_NUCLEO_F401RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE -I$(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM
LIBRARY_PATHS += -L$(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_NUCLEO_F401RE/TOOLCHAIN_GCC_ARM/STM32F401XE.ld
ifeq ($(USE_LWIP), 1)
INCLUDE_PATHS += -I$(MBED_LIBS)/lwip/lwip-eth/arch/TARGET_STM
endif
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_NUCLEO_F401RE -D__CORTEX_M4 -DTARGET_CORTEX_M -D__FPU_PRESENT=1 -D__MBED__=1 -DTARGET_M4 -DTARGET_FF_MORPHO -DTARGET_STM -DTARGET_STM32F4 -DTOOLCHAIN_GCC -DTARGET_STM32F401RE -DARM_MATH_CM4 -DMBED_BUILD_TIMESTAMP=1450373147.1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
#
# STM32F091
#
else ifeq ($(TARGET),STM32F091)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x6000
CC_FLAGS += -D__HEAP_SIZE=0x6000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_stm32f091xc.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_smartcard.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_adc.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_adc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_can.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_cec.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_comp.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_cortex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_crc.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_crc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_dac.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_dac_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_dma.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_flash.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_flash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_gpio.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_i2c.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_i2c_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_i2s.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_irda.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_iwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_pcd.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_pcd_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_pwr.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_pwr_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_rcc.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_rcc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_rtc.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_rtc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_smartcard_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_smbus.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_spi.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_spi_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_tim.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_tim_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_tsc.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_uart.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_uart_ex.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_usart.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/stm32f0xx_hal_wwdg.o $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/system_stm32f0xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_NUCLEO_F091RC -I$(MBED_ROOT)/TARGET_NUCLEO_F091RC/TARGET_STM -I$(MBED_ROOT)/TARGET_NUCLEO_F091RC/TARGET_STM/TARGET_STM32F0 -I$(MBED_ROOT)/TARGET_NUCLEO_F091RC/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC -I$(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM
LIBRARY_PATHS += -L$(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_NUCLEO_F091RC/TOOLCHAIN_GCC_ARM/STM32F091XC.ld
CPU = -mcpu=cortex-m0 -mthumb
CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fexceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -D__CORTEX_M0 -DMBED_BUILD_TIMESTAMP=1452888922.57 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -DTARGET_FF_MORPHO -DTARGET_CORTEX_M -DARM_MATH_CM0 -DTARGET_STM -DTARGET_STM32F0 -DTARGET_M0 -DTARGET_NUCLEO_F091RC -DTARGET_STM32F091RC -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
else
$(error TARGET is not recognized. Please check the value passed in)
endif
DEPS = $(OBJECTS:.o=.d)
###############
# Build tools #
###############
AS = "$(GCC_BIN)arm-none-eabi-as"
CC = "$(GCC_BIN)arm-none-eabi-gcc"
CPP = "$(GCC_BIN)arm-none-eabi-g++"
LD = "$(GCC_BIN)arm-none-eabi-gcc"
OBJCOPY = "$(GCC_BIN)arm-none-eabi-objcopy"
OBJDUMP = "$(GCC_BIN)arm-none-eabi-objdump"
SIZE = "$(GCC_BIN)arm-none-eabi-size"
ifeq ($(DEBUG), 1)
CC_FLAGS += -DDEBUG -Og
else
CC_FLAGS += -DNDEBUG -Os
endif
###########
# Recipes #
###########
.PHONY: all clean lst size
all: ${TARGET} $(TARGET)\$(PROJECT).bin $(TARGET)\$(PROJECT).hex size
dumps: ${TARGET} $(TARGET)\$(PROJECT).lst $(TARGET)\$(PROJECT).disasm
# Conditionals (ifeq/ifneq) are bugged on Windows. Instead, we'll just ensure the directory exists and remove it unconditionally.
cleanclean: ${TARGET}
@del /q /f /s $(TARGET)\mbed*.o
@del /q /f /s $(TARGET)\mbed*.d
@del /q /f /s $(TARGET)\$(PROJECT).elf
@del /q /f /s $(TARGET)\$(PROJECT).bin
@del /q /f /s $(TARGET)\$(PROJECT).hex
@del /q /f /s $(TARGET)\$(PROJECT).disasm
@del /q /f /s $(TARGET)\$(PROJECT).lst
@del /q /f /s $(TARGET)\$(PROJECT).map
# Conditionals (ifeq/ifneq) are bugged on Windows. Instead, we'll just ensure the directory exists and remove it unconditionally.
clean: ${TARGET}
@del /q /f /s $(TARGET)\$(PROJECT).elf
@del /q /f /s $(TARGET)\$(PROJECT).bin
@del /q /f /s $(TARGET)\$(PROJECT).hex
@del /q /f /s $(TARGET)\$(PROJECT).disasm
@del /q /f /s $(TARGET)\$(PROJECT).lst
@del /q /f /s $(TARGET)\$(PROJECT).map
# Ensures the target directory has been created.
${TARGET}:
@mkdir $@
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ARMv7M\Vectors\%.S
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ARMv7M\Vectors\%.s
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ports\mbed\%.S
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\lwip\lwip-sys\arch\%.c
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: %.c
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: $(SOURCE_ROOT)\%.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ports\mbed\%.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS)
$(TARGET)\$(PROJECT).bin: $(TARGET)\$(PROJECT).elf
$(OBJCOPY) -O binary $< $@
$(TARGET)\$(PROJECT).hex: $(TARGET)\$(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@
$(TARGET)\$(PROJECT).lst: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@
$(TARGET)\$(PROJECT).disasm: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -D $< > $@
size: $(TARGET)\$(PROJECT).elf
@echo Size report...
$(SIZE) $<
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/build.bat
================================================
@echo off
setlocal enableDelayedExpansion
IF %1.==. (
ECHO.
ECHO Error no test name given. e.g. Build.bat GpioTest LPC1768
GOTO :EOF
)
IF NOT EXIST "Microsoft.Zelig.Test.%1.ll" (
ECHO.
ECHO Error invalid test name given: %1. Microsoft.Zelig.Test.%1.ll was not found!
GOTO :EOF
)
@REM - set this ENVIRONMENT Variable to override default optimization level for testing
IF NOT DEFINED LLILUM_OPT_LEVEL SET LLILUM_OPT_LEVEL=2
IF /i "%LLVM_BIN%"=="" (
ECHO LLVM_BIN is not defined. Please define LLVM_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
IF %2.==. (
ECHO No target passed in. Defaulting to LPC1768
set TARGET=LPC1768
set SIZE_OF_HEAP=0x6A00
) ELSE (
ECHO Detected target: %2
set TARGET=%2
IF "%2"=="K64F" (
set SIZE_OF_HEAP=0x40000
) ELSE (
set SIZE_OF_HEAP=0x6A00
)
)
@REM - To skip optimizations for testing you can set this ENVIRONMENT variable, otherwise the optimization will run as normal
IF NOT DEFINED LLILUM_SKIP_OPT (
ECHO Running LLVM Optimization Phases...
@REM -"%LLVM_BIN%\opt" -O2 -adce -globaldce Microsoft.Zelig.Test.%1.bc -o Microsoft.Zelig.Test.%1_opt.bc
@REM -"%LLVM_BIN%\opt" -O1 -globalopt -constmerge -adce -globaldce -time-passes Microsoft.Zelig.Test.%1.bc -o Microsoft.Zelig.Test.%1_opt.bc
"%LLVM_BIN%\opt" -verify-debug-info -verify-dom-info -verify-each -verify-loop-info -verify-regalloc -verify-region-info Microsoft.Zelig.Test.%1.bc -o Microsoft.Zelig.Test.%1_verify.bc
"%LLVM_BIN%\opt" -march=thumb -mcpu=cortex-m3 -aa-eval -indvars -gvn -globaldce -adce -dce -tailcallopt -scalarrepl -mem2reg -ipconstprop -deadargelim -sccp -dce -ipsccp -dce -constmerge -scev-aa -targetlibinfo -irce -dse -dce -argpromotion -mem2reg -adce -mem2reg -globaldce -die -dce -dse -time-passes Microsoft.Zelig.Test.%1.bc -o Microsoft.Zelig.Test.%1_opt.bc
) else (
Echo Skipping optimization passes...
copy Microsoft.Zelig.Test.%1.bc Microsoft.Zelig.Test.%1_opt.bc
)
@REM -"%LLVM_BIN%\llvm-bcanalyzer" Microsoft.Zelig.Test.%1_opt.bc
ECHO Cenerating LLVM IR source file...
"%LLVM_BIN%\llvm-dis" Microsoft.Zelig.Test.%1_opt.bc
ECHO Compiling to ARM...
"%LLVM_BIN%\llc" -O%LLILUM_OPT_LEVEL% -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m3 -filetype=obj -mtriple=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF -o=Microsoft.Zelig.Test.%1_opt.o Microsoft.Zelig.Test.%1_opt.bc
if %ERRORLEVEL% LSS 0 (
@echo ERRORLEVEL=%ERRORLEVEL%
goto :EXIT
)
ECHO Size Report...
"%GCC_BIN%\arm-none-eabi-size.exe" Microsoft.Zelig.Test.%1_opt.o
ECHO.
ECHO Linking with mbed libs...
make clean TARGET=%TARGET% PROJECT=%1
make DEBUG=1 TARGET=%TARGET% HEAP_SIZE=%SIZE_OF_HEAP% PROJECT=%1
GOTO :EXIT
:EXIT
ECHO.
ECHO Completed
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/buildK64F.bat
================================================
@echo off
IF %1.==. (
ECHO Error no test name given. e.g. BuildK64F.bat GpioTest
GOTO :EOF
)
"%dp~0%build.bat" %1 K64F
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/buildLPC1768.bat
================================================
@echo off
IF %1.==. (
ECHO Error no test name given. e.g. BuildK64F.bat GpioTest
GOTO :EOF
)
"%dp~0%build.bat" %1 LPC1768
EXIT /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/debug.bat
================================================
@echo off
IF /i "%GCC_BIN%"=="" (
ECHO GCC_BIN is not defined. Please define GCC_BIN to point to LLVM tools and binaries.
GOTO :EXIT
)
ECHO.
ECHO Trying to start pyOCD for Windows
START /I pyocd_win.exe
PAUSE
ECHO.
ECHO Trying to attach to remote target on port 3333
"%GCC_BIN%arm-none-eabi-gdb.exe" %*
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/debugK64F.bat
================================================
@echo off
"%dp~0%debug.bat" K64F\*.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/debugLPC1768.bat
================================================
@echo off
"%dp~0%debug.bat" LPC1768\*.elf %* -ex "target remote :3333" -ex "monitor halt reset" -ex "ni"
exit /b
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/deploy.bat
================================================
@ECHO OFF
setlocal enabledelayedexpansion
IF %1.==. (
ECHO No target passed in. Defaulting to LPC1768
set TARGET=LPC1768
) ELSE (
ECHO Detected target: %1
set TARGET=%1
)
SET DEPLOY_DRIVE=e:
IF "%2" NEQ "" (
set DEPLOY_DRIVE=%2
) ELSE IF EXIST "e:\MBED.HTM" (
set DEPLOY_DRIVE=e:
) ELSE IF EXIST "f:\MBED.HTM" (
set DEPLOY_DRIVE=f:
) ELSE IF EXIST "g:\MBED.HTM" (
set DEPLOY_DRIVE=g:
) ELSE IF EXIST "h:\MBED.HTM" (
set DEPLOY_DRIVE=h:
)
IF NOT EXIST %DEPLOY_DRIVE%\ (
@ECHO.
@ECHO Error: device drive not found!
@ECHO.
GOTO :USAGE
)
@ECHO Deleting old image (%DEPLOY_DRIVE%\*.bin) ...
del %DEPLOY_DRIVE%\*.bin
@ECHO Installing new image (%TARGET%\*.bin) to %DEPLOY_DRIVE%\...
copy %TARGET%\*.bin %DEPLOY_DRIVE%\.
@ECHO Complete!
GOTO :EOF
:USAGE
@ECHO Usage: deploy.bat [DeployDeviceDrive]
@ECHO e.g. 'deploy.bat e:'
@ECHO.
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/deployK64F.bat
================================================
deploy.bat K64F
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/deployLPC1768.bat
================================================
deploy.bat LPC1768
================================================
FILE: Zelig/LLVM2IR_results/mbed/test/makefile
================================================
#
# Project-specific settings
#
VERBOSE=1
ifndef PROJECT
$(error PROJECT is not defined. Define PROJECT to the target test.)
endif
#
# TODO: Move InteropExports_* to common directory.
#
OBJECTS = .\Microsoft.Zelig.Test.$(PROJECT)_opt.o \
$(TARGET)\mbed_adc.o \
$(TARGET)\mbed_asm.o \
$(TARGET)\mbed_clock.o \
$(TARGET)\mbed_core.o \
$(TARGET)\mbed_debug.o \
$(TARGET)\mbed_gpio.o \
$(TARGET)\mbed_i2c.o \
$(TARGET)\mbed_mem.o \
$(TARGET)\mbed_memory.o \
$(TARGET)\mbed_NVIC.o \
$(TARGET)\mbed_pwm.o \
$(TARGET)\mbed_serial.o \
$(TARGET)\mbed_spi.o \
$(TARGET)\mbed_system_timer.o \
$(TARGET)\mbed_SysTick.o \
$(TARGET)\mbed_threading.o \
#
# Paths and includes
# TODO: Make this algorithmic based on TARGET.
#
ifndef GCC_BIN
$(error GCC_BIN is undefined. Define GCC_BIN to point to arm-none-eabi-xxx tools)
endif
ifndef TARGET
$(error TARGET is undefined. Pass in TARGET for desired board)
endif
ifeq ($(HARDFP),1)
FLOAT_ABI = hard
else
FLOAT_ABI = softfp
endif
# Common settings
MBED_ROOT = $(LLILUM_ROOT)Zelig\mbed
SOURCE_ROOT = $(LLILUM_ROOT)Zelig\LLVM2IR_results\mbed\test
LIBRARIES = -lmbed
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
INCLUDE_PATHS = -I. -I$(MBED_ROOT) -I$(LLILUM_ROOT)Zelig\os_layer\inc -I$(LLILUM_ROOT)Zelig\os_layer\inc\api -I$(LLILUM_ROOT)Zelig\os_layer\inc\api\io -I$(LLILUM_ROOT)Zelig\os_layer\inc\hal
# LPC1768 settings
ifeq ($(TARGET),LPC1768)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x4000
CC_FLAGS += -D__HEAP_SIZE=0x4000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_LPC17xx.o
SYS_OBJECTS = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\board.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\cmsis_nvic.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\retarget.o $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\system_LPC17xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)\TARGET_LPC1768 -I$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X -I$(MBED_ROOT)\TARGET_LPC1768\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768
LIBRARY_PATHS = -L$(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\LPC1768.ld
# Build flags
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS += $(CPU) -c -g3 -gdwarf-4 -fvar-tracking-assignments -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_CORTEX_M -DTARGET_NXP -DTARGET_LPC176X -DTARGET_MBED_LPC1768 -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3 -DMBED_BUILD_TIMESTAMP=1435185689.48 -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
# K64F settings
else ifeq ($(TARGET),K64F)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x10000
CC_FLAGS += -D__HEAP_SIZE=0x10000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_MK64F12.o
# SYS_OBJECTS = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/system_MK64F12.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/retarget.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/system_MK64F12.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/retarget.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_K64F -I$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/device/MK64F12 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common/phyksz8081 -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lptmr -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dac -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/gpio -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/port -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/llwu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sim -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rcm -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sdhc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/can -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mpu -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/smc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/osc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/flextimer -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pdb -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/i2c -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/uart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dspi -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/lpuart -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sai -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rtc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mcg -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/edma -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pmc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/wdog -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dmamux -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/utilities -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/enet -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit/common -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/interrupt -I$(MBED_ROOT)/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock
LIBRARY_PATHS = -L$(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)/TARGET_K64F/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld
# Build flags
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI)
CC_FLAGS += $(CPU) -c -g3 -gdwarf-4 -fvar-tracking-assignments -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_K64F -DTARGET_M4 -DTARGET_CORTEX_M -DTARGET_Freescale -DTARGET_KPSDK_MCUS -DTARGET_KPSDK_CODE -DTARGET_MCU_K64F -DTARGET_FRDM -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M4 -DARM_MATH_CM4 -D__FPU_PRESENT=1 -DMBED_BUILD_TIMESTAMP=1435855534.71 -D__MBED__=1 -DCPU_MK64FN1M0VMD12 -DFSL_RTOS_MBED -DTARGET_FF_ARDUINO
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(TARGET)\$(PROJECT).map,--cref
# STM32L152
else ifeq ($(TARGET),STM32L152)
ifeq ($(HEAP_SIZE),)
AS_FLAGS += --defsym __HEAP_SIZE=0x4000
CC_FLAGS += -D__HEAP_SIZE=0x4000
else
AS_FLAGS += --defsym __HEAP_SIZE=$(HEAP_SIZE)
CC_FLAGS += -D__HEAP_SIZE=$(HEAP_SIZE)
endif
OBJECTS += $(TARGET)\startup_stm32l152xe.o
SYS_OBJECTS = $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash_ramfunc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_adc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_adc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_comp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cortex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_crc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cryp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_cryp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dac.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dac_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_dma.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_flash_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_smartcard.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_gpio.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_i2c.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_i2s.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_irda.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_iwdg.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_lcd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_nor.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_opamp.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_opamp_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pcd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pcd_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pwr.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_pwr_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rcc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rcc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rtc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_rtc_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_sd.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_spi.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_spi_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_sram.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_tim.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_tim_ex.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_uart.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_usart.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_hal_wwdg.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_ll_fsmc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/stm32l1xx_ll_sdmmc.o $(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/system_stm32l1xx.o
INCLUDE_PATHS += -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM/TARGET_STM32L1 -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TARGET_STM/TARGET_STM32L1/TARGET_NUCLEO_L152RE -I$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM
LIBRARY_PATHS = -L$(MBED_ROOT)/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM
LINKER_SCRIPT = $(MBED_ROOT)\TARGET_NUCLEO_L152RE\TOOLCHAIN_GCC_ARM\STM32L152XE.ld
# Build flags
CPU = -mcpu=cortex-m3 -mthumb
CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DMBED_BUILD_TIMESTAMP=1445629897.99 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -DTARGET_FF_MORPHO -DTARGET_CORTEX_M -DARM_MATH_CM3 -DTARGET_STM32L1 -DTARGET_STM -D__CORTEX_M3 -DTARGET_NUCLEO_L152RE -DTARGET_M3 -DTARGET_STM32L152RE -D__MBED__=1
LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
else
$(error TARGET is not recognized. Please check the value passed in)
endif
DEPS = $(OBJECTS:.o=.d)
#
# Build tools
#
AS = "$(GCC_BIN)arm-none-eabi-as"
CC = "$(GCC_BIN)arm-none-eabi-gcc"
CPP = "$(GCC_BIN)arm-none-eabi-g++"
LD = "$(GCC_BIN)arm-none-eabi-gcc"
OBJCOPY = "$(GCC_BIN)arm-none-eabi-objcopy"
OBJDUMP = "$(GCC_BIN)arm-none-eabi-objdump"
SIZE = "$(GCC_BIN)arm-none-eabi-size"
ifeq ($(DEBUG), 1)
CC_FLAGS += -DDEBUG -O0
else
CC_FLAGS += -DNDEBUG -Os
endif
#
# Recipes
#
.PHONY: all clean lst size
all: ${TARGET} $(TARGET)\$(PROJECT).bin $(TARGET)\$(PROJECT).hex $(TARGET)\$(PROJECT).lst $(TARGET)\$(PROJECT).disasm size
# Conditionals (ifeq/ifneq) are bugged on Windows. Instead, we'll just ensure the directory exists and remove it unconditionally.
clean: ${TARGET}
@rmdir /q /s $(TARGET)
# Ensures the target directory has been created.
${TARGET}:
@mkdir $@
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ARMv7M\Vectors\%.S
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ARMv7M\Vectors\%.s
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ports\mbed\%.S
$(AS) $(CPU) $(AS_FLAGS) -o $@ $<
$(TARGET)\\%.o: %.c
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: $(SOURCE_ROOT)\%.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\\%.o: $(LLILUM_ROOT)\Zelig\os_layer\ports\mbed\%.cpp
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(TARGET)\$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
$(TARGET)\$(PROJECT).bin: $(TARGET)\$(PROJECT).elf
$(OBJCOPY) -O binary $< $@
$(TARGET)\$(PROJECT).hex: $(TARGET)\$(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@
$(TARGET)\$(PROJECT).lst: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -Sdh $< > $@
$(TARGET)\$(PROJECT).disasm: $(TARGET)\$(PROJECT).elf
@$(OBJDUMP) -D $< > $@
size: $(TARGET)\$(PROJECT).elf
@echo Size report...
$(SIZE) $<
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/IRCompare.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{186F31A3-EF89-4A25-B2D5-20070211AA01}
WinExe
Properties
Microsoft.Zelig.Tools.IRCompare
Microsoft.Zelig.Tools.IRCompare
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
v4.5
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE;DEBUG
AnyCPU
false
false
3.5
Form
MainForm.cs
Form
MethodViewer.cs
Designer
MainForm.cs
Designer
MethodViewer.cs
ResXFileCodeGenerator
Resources.Designer.cs
Designer
True
Resources.resx
True
SettingsSingleFileGenerator
Settings.Designer.cs
True
Settings.settings
True
{186F31A3-EF89-4A25-B2D5-20070222AA01}
CodeTransformation
False
{186F31A3-EF89-4A25-B2D5-20060603AA01}
IntermediateRepresentation
False
{186F31A3-EF89-4A25-B2D5-20061218AA01}
Common
False
{186F31A3-EF89-4A25-B2D5-20060720AA01}
TypeSystem
False
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MainForm.Designer.cs
================================================
namespace Microsoft.Zelig.Tools.IRCompare
{
partial class MainForm
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose( bool disposing )
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBoxMethods = new System.Windows.Forms.GroupBox();
this.listBoxMethods = new System.Windows.Forms.ListBox();
this.textBoxFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.groupBoxMethods.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(577, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
this.openToolStripMenuItem.Text = "&Open...";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// openFileDialog1
//
this.openFileDialog1.Filter = "Zelig Image|*.ZeligImage";
this.openFileDialog1.Title = "Open Zelig Image";
//
// groupBoxMethods
//
this.groupBoxMethods.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxMethods.Controls.Add(this.listBoxMethods);
this.groupBoxMethods.Location = new System.Drawing.Point(12, 68);
this.groupBoxMethods.Name = "groupBoxMethods";
this.groupBoxMethods.Size = new System.Drawing.Size(553, 186);
this.groupBoxMethods.TabIndex = 1;
this.groupBoxMethods.TabStop = false;
this.groupBoxMethods.Text = "Methods";
//
// listBoxMethods
//
this.listBoxMethods.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBoxMethods.FormattingEnabled = true;
this.listBoxMethods.Location = new System.Drawing.Point(3, 16);
this.listBoxMethods.Name = "listBoxMethods";
this.listBoxMethods.Size = new System.Drawing.Size(547, 160);
this.listBoxMethods.TabIndex = 0;
this.listBoxMethods.DoubleClick += new System.EventHandler(this.listBoxMethods_DoubleClick);
//
// textBoxFilter
//
this.textBoxFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxFilter.Location = new System.Drawing.Point(49, 42);
this.textBoxFilter.Name = "textBoxFilter";
this.textBoxFilter.Size = new System.Drawing.Size(513, 20);
this.textBoxFilter.TabIndex = 2;
this.textBoxFilter.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Filter:";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(577, 266);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxFilter);
this.Controls.Add(this.groupBoxMethods);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "IR Compare";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBoxMethods.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.GroupBox groupBoxMethods;
private System.Windows.Forms.ListBox listBoxMethods;
private System.Windows.Forms.TextBox textBoxFilter;
private System.Windows.Forms.Label label1;
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MainForm.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.IRCompare
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
using System.IO;
////using ARM = Microsoft.Zelig.Emulation.ArmProcessor;
public partial class MainForm : Form
{
//
// State
//
Dictionary< string, TS.MethodRepresentation > m_lookupMethod;
IR.TypeSystemForCodeTransformation m_typeSystem;
RenderMethod m_renderer;
string m_IRName;
//
// Constructor Methods
//
public MainForm()
{
InitializeComponent();
m_renderer = new RenderMethod();
}
//--/
private object CreateInstanceForType( Type t )
{
if(t == typeof(IR.TypeSystemForCodeTransformation))
{
return new IR.TypeSystemForCodeTransformation( null );
}
return null;
}
//--//
private void openToolStripMenuItem_Click( object sender ,
EventArgs e )
{
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
m_IRName = Path.GetFileNameWithoutExtension( openFileDialog1.FileName );
int idx = m_IRName.LastIndexOf( '.' );
if(idx >= 0)
{
m_IRName = m_IRName.Substring( idx + 1, m_IRName.Length - idx - 1 );
}
this.Text = "IR Compare - " + m_IRName;
using(System.IO.FileStream stream = new System.IO.FileStream( openFileDialog1.FileName, System.IO.FileMode.Open ))
{
m_typeSystem = IR.TypeSystemSerializer.Deserialize( stream, CreateInstanceForType, null, 0 );
m_lookupMethod = new Dictionary< string, TS.MethodRepresentation >();
m_typeSystem.EnumerateMethods( delegate( TS.MethodRepresentation md )
{
m_lookupMethod[md.ToShortString()] = md;
} );
}
UpdateListBox();
}
catch
{
}
}
}
private void textBoxFilter_TextChanged( object sender ,
EventArgs e )
{
UpdateListBox();
}
private void UpdateListBox()
{
if(m_lookupMethod != null)
{
string filter = textBoxFilter.Text.ToLower();
List< string > lst = new List();
foreach(string id in m_lookupMethod.Keys)
{
if(string.IsNullOrEmpty( filter ) || id.ToLower().Contains( filter ))
{
lst.Add( id );
}
}
lst.Sort();
ListBox.ObjectCollection col = listBoxMethods.Items;
listBoxMethods.SuspendLayout();
col.Clear();
col.AddRange( lst.ToArray() );
listBoxMethods.ResumeLayout();
}
}
private void listBoxMethods_DoubleClick( object sender ,
EventArgs e )
{
if(m_lookupMethod != null && listBoxMethods.SelectedItem != null)
{
TS.MethodRepresentation method = m_lookupMethod[ (string)listBoxMethods.SelectedItem ];
MethodViewer mv = new MethodViewer( m_lookupMethod, method, m_renderer, m_IRName );
mv.Show();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MainForm.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
17, 17
126, 17
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MethodViewer.Designer.cs
================================================
namespace Microsoft.Zelig.Tools.IRCompare
{
partial class MethodViewer
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose( bool disposing )
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPageVariables = new System.Windows.Forms.TabPage();
this.listViewVariables = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.tabPageBasicBlock = new System.Windows.Forms.TabPage();
this.listBoxBasicBlock = new System.Windows.Forms.ListBox();
this.checkBoxExpandBasicBlocks = new System.Windows.Forms.CheckBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPageVariables.SuspendLayout();
this.tabPageBasicBlock.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point( 148, 10 );
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size( 716, 20 );
this.textBox1.TabIndex = 1;
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point( 12, 39 );
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add( this.richTextBox1 );
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add( this.tabControl1 );
this.splitContainer1.Size = new System.Drawing.Size( 856, 373 );
this.splitContainer1.SplitterDistance = 301;
this.splitContainer1.TabIndex = 2;
//
// tabControl1
//
this.tabControl1.Controls.Add( this.tabPageVariables );
this.tabControl1.Controls.Add( this.tabPageBasicBlock );
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point( 0, 0 );
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size( 551, 373 );
this.tabControl1.TabIndex = 1;
//
// tabPageVariables
//
this.tabPageVariables.Controls.Add( this.listViewVariables );
this.tabPageVariables.Location = new System.Drawing.Point( 4, 22 );
this.tabPageVariables.Name = "tabPageVariables";
this.tabPageVariables.Padding = new System.Windows.Forms.Padding( 3 );
this.tabPageVariables.Size = new System.Drawing.Size( 543, 347 );
this.tabPageVariables.TabIndex = 1;
this.tabPageVariables.Text = "Variables";
this.tabPageVariables.UseVisualStyleBackColor = true;
//
// listViewVariables
//
this.listViewVariables.Columns.AddRange( new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2} );
this.listViewVariables.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewVariables.Location = new System.Drawing.Point( 3, 3 );
this.listViewVariables.Name = "listViewVariables";
this.listViewVariables.Size = new System.Drawing.Size( 537, 341 );
this.listViewVariables.TabIndex = 0;
this.listViewVariables.UseCompatibleStateImageBehavior = false;
this.listViewVariables.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "Name";
//
// columnHeader2
//
this.columnHeader2.Text = "Type";
this.columnHeader2.Width = 266;
//
// tabPageBasicBlock
//
this.tabPageBasicBlock.Controls.Add( this.listBoxBasicBlock );
this.tabPageBasicBlock.Location = new System.Drawing.Point( 4, 22 );
this.tabPageBasicBlock.Name = "tabPageBasicBlock";
this.tabPageBasicBlock.Padding = new System.Windows.Forms.Padding( 3 );
this.tabPageBasicBlock.Size = new System.Drawing.Size( 543, 347 );
this.tabPageBasicBlock.TabIndex = 0;
this.tabPageBasicBlock.Text = "Basic Block";
this.tabPageBasicBlock.UseVisualStyleBackColor = true;
//
// listBoxBasicBlock
//
this.listBoxBasicBlock.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBoxBasicBlock.FormattingEnabled = true;
this.listBoxBasicBlock.HorizontalScrollbar = true;
this.listBoxBasicBlock.IntegralHeight = false;
this.listBoxBasicBlock.Location = new System.Drawing.Point( 3, 3 );
this.listBoxBasicBlock.Name = "listBoxBasicBlock";
this.listBoxBasicBlock.Size = new System.Drawing.Size( 537, 341 );
this.listBoxBasicBlock.TabIndex = 0;
//
// checkBoxExpandBasicBlocks
//
this.checkBoxExpandBasicBlocks.AutoSize = true;
this.checkBoxExpandBasicBlocks.Location = new System.Drawing.Point( 12, 12 );
this.checkBoxExpandBasicBlocks.Name = "checkBoxExpandBasicBlocks";
this.checkBoxExpandBasicBlocks.Size = new System.Drawing.Size( 126, 17 );
this.checkBoxExpandBasicBlocks.TabIndex = 3;
this.checkBoxExpandBasicBlocks.Text = "Expand Basic Blocks";
this.checkBoxExpandBasicBlocks.UseVisualStyleBackColor = true;
this.checkBoxExpandBasicBlocks.CheckedChanged += new System.EventHandler( this.checkBoxExpandBasicBlocks_CheckedChanged );
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point( 0, 0 );
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size( 301, 373 );
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// MethodViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size( 880, 424 );
this.Controls.Add( this.checkBoxExpandBasicBlocks );
this.Controls.Add( this.splitContainer1 );
this.Controls.Add( this.textBox1 );
this.Name = "MethodViewer";
this.Text = "Method Viewer";
this.Load += new System.EventHandler( this.MethodViewer_Load );
this.splitContainer1.Panel1.ResumeLayout( false );
this.splitContainer1.Panel2.ResumeLayout( false );
this.splitContainer1.ResumeLayout( false );
this.tabControl1.ResumeLayout( false );
this.tabPageVariables.ResumeLayout( false );
this.tabPageBasicBlock.ResumeLayout( false );
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPageBasicBlock;
private System.Windows.Forms.TabPage tabPageVariables;
private System.Windows.Forms.ListBox listBoxBasicBlock;
private System.Windows.Forms.ListView listViewVariables;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.CheckBox checkBoxExpandBasicBlocks;
private System.Windows.Forms.RichTextBox richTextBox1;
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MethodViewer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.IRCompare
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
////using ARM = Microsoft.Zelig.Emulation.ArmProcessor;
public partial class MethodViewer : Form
{
//
// State
//
Dictionary< string, TS.MethodRepresentation > m_lookupMethod;
TS.MethodRepresentation m_method;
RenderMethod m_renderer;
List< RenderMethod.OutputLine > m_text;
string m_irName;
bool m_fExpandBasicBlocks;
IR.BasicBlock m_selectedBasicBlock;
//
// Constructor Methods
//
public MethodViewer( Dictionary< string, TS.MethodRepresentation > lookupMethod ,
TS.MethodRepresentation method ,
RenderMethod renderer ,
string irName )
{
m_lookupMethod = lookupMethod;
m_method = method;
m_renderer = renderer;
m_irName = irName;
m_fExpandBasicBlocks = false;
InitializeComponent();
}
private void UpdateDisplay()
{
textBox1.Text = m_method.Name;
Text = "MethodViewer - " + m_method.Name + " - IR: " + m_irName;
//--//
ListVariables();
m_text = m_renderer.DumpMethod( m_method );
string[] lines = new string[m_text.Count];
for(int i = 0; i < m_text.Count; i++)
{
lines[i] = m_text[i].Text;
}
richTextBox1.Lines = lines;
SelectBasicBlock( null );
}
//--//
private void ListVariables()
{
ListView.ListViewItemCollection col = listViewVariables.Items;
listViewVariables.SuspendLayout();
col.Clear();
IR.ControlFlowGraphStateForCodeTransformation cfg = IR.TypeSystemForCodeTransformation.GetCodeForMethod( m_method );
if(cfg != null)
{
foreach(IR.VariableExpression var in cfg.DataFlow_SpanningTree_Variables)
{
string name;
if(var.DebugName != null)
{
name = var.DebugName.Name;
}
else
{
name = var.ToString();
}
ListViewItem lvi = new ListViewItem( name );
lvi.SubItems.Add( var.Type.ToString() );
col.Add( lvi );
}
}
listViewVariables.ResumeLayout();
tabControl1.SelectedTab = tabPageVariables;
}
//--//--//
private void SelectBasicBlock( IR.BasicBlock bb )
{
ListBox.ObjectCollection col = listBoxBasicBlock.Items;
listBoxBasicBlock.SuspendLayout();
col.Clear();
m_selectedBasicBlock = bb;
if(bb != null)
{
foreach(IR.Operator op in bb.Operators)
{
col.Add( op );
}
}
listBoxBasicBlock.ResumeLayout();
tabControl1.SelectedTab = tabPageBasicBlock;
}
//--//--//
private void MethodViewer_Load( object sender ,
EventArgs e )
{
UpdateDisplay();
}
private void listBoxBasicBlock_DoubleClick( object sender ,
EventArgs e )
{
if(m_selectedBasicBlock != null)
{
int i = listBoxBasicBlock.SelectedIndex;
if(i >= 0 && i < m_selectedBasicBlock.Operators.Length)
{
IR.Operator op = m_selectedBasicBlock.Operators[i];
if(op is IR.CallOperator)
{
m_method = ((IR.CallOperator)op).TargetMethod;
UpdateDisplay();
}
}
}
}
private void checkBoxExpandBasicBlocks_CheckedChanged( object sender ,
EventArgs e )
{
m_fExpandBasicBlocks = checkBoxExpandBasicBlocks.Checked;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/MethodViewer.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Microsoft.Zelig.Tools.IRCompare
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new MainForm() );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "IRCompare" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "IRCompare" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2006" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
//// The following GUID is for the ID of the typelib if this project is exposed to COM
//[assembly: Guid( "fafaa296-9d0d-42fa-b922-8fb69f2544b2" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Properties/Resources.Designer.cs
================================================
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace Microsoft.Zelig.Tools.IRCompare.Properties {
using System;
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Zelig.Tools.IRCompare.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Properties/Resources.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Properties/Settings.Designer.cs
================================================
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace Microsoft.Zelig.Tools.IRCompare.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/Properties/Settings.settings
================================================
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/RenderMethod.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.IRCompare
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
////using ARM = Microsoft.Zelig.Emulation.ArmProcessor;
public class RenderMethod : IR.BaseIntermediateRepresentationDumper
{
public class OutputLine
{
public string Text;
public IR.Operator Operator;
}
//
// State
//
IR.Operator m_currentOperator;
StringBuilder m_writer;
List< OutputLine > m_output;
int m_indent;
bool m_fIndented;
//
// Constructor Methods
//
public RenderMethod()
{
m_writer = new StringBuilder();
}
//--//
private void AddLine()
{
OutputLine ol = new OutputLine();
ol.Text = m_writer.ToString();
ol.Operator = m_currentOperator;
m_output.Add( ol );
m_writer.Length = 0;
}
public void WriteLine()
{
WriteIndentation();
AddLine();
m_fIndented = false;
}
public void WriteLine( string s )
{
WriteIndentation();
m_writer.Append( s );
AddLine();
m_fIndented = false;
}
public void WriteLine( string s ,
object arg1 )
{
WriteIndentedLine( s, arg1 );
}
public void WriteLine( string s ,
object arg1 ,
object arg2 )
{
WriteIndentedLine( s, arg1, arg2 );
}
public void WriteLine( string s ,
object arg1 ,
object arg2 ,
object arg3 )
{
WriteIndentedLine( s, arg1, arg2, arg3 );
}
public void WriteLine( string s ,
params object[] args )
{
WriteIndentedLine( s, args );
}
//--//
public List< OutputLine > DumpMethod( TS.MethodRepresentation md )
{
m_output = new List< OutputLine >();
DumpGraph( IR.TypeSystemForCodeTransformation.GetCodeForMethod( md ) );
return m_output;
}
public override void DumpGraph( IR.ControlFlowGraphState cfg )
{
IR.ControlFlowGraphStateForCodeTransformation cfg2 = (IR.ControlFlowGraphStateForCodeTransformation)cfg;
base.DumpGraph( cfg2 );
//--//
if(m_sortedVariables.Length > 0)
{
m_indent += 3;
foreach(IR.VariableExpression ex in m_sortedVariables)
{
WriteLine( "{0} {1} as {2}", m_useChains[ex.SpanningTreeIndex].Length > 0 ? " var" : "unused var", ex, ex.Type );
}
m_indent -= 3;
WriteLine();
}
foreach(IR.BasicBlock bb in m_basicBlocks)
{
ProcessBasicBlock( bb );
}
}
private void ProcessBasicBlock( IR.BasicBlock bb )
{
m_indent += 1;
string label = CreateLabel( bb );
if(label != null)
{
WriteLine( "{0}: [Index:{1}] [Annotation:{2}]", label, bb.SpanningTreeIndex, bb.Annotation );
}
m_indent += 4;
if(bb is IR.ExceptionHandlerBasicBlock)
{
IR.ExceptionHandlerBasicBlock ehBB = (IR.ExceptionHandlerBasicBlock)bb;
foreach(IR.ExceptionClause eh in ehBB.HandlerFor)
{
WriteLine( ".handler for {0}", eh );
}
}
foreach(IR.ExceptionHandlerBasicBlock bbEh in bb.ProtectedBy)
{
foreach(IR.ExceptionClause eh in bbEh.HandlerFor)
{
WriteLine( ".protected by {0} at {1}", eh, CreateLabel( bbEh ) );
}
}
foreach(IR.BasicBlockEdge edge in bb.Predecessors)
{
WriteLine( ".edge {0} from {1}", edge.EdgeClass, CreateLabel( edge.Predecessor ) );
}
foreach(IR.BasicBlockEdge edge in bb.Successors)
{
WriteLine( ".edge {0} to {1}", edge.EdgeClass, CreateLabel( edge.Successor ) );
}
GrowOnlySet< IR.Expression > used = SetFactory.NewWithReferenceEquality< IR.Expression >();
foreach(IR.Operator op in bb.Operators)
{
foreach(IR.Expression ex in op.Arguments)
{
used.Insert( ex );
}
}
foreach(IR.Expression ex in used)
{
bool fGot = false;
foreach(int opIndex in m_reachingDefinitions[bb.Operators[0].SpanningTreeIndex])
{
if(m_operators[opIndex].IsSourceOfExpression( ex ))
{
if(fGot == false)
{
WriteIndented( ".reaching {0} <=", ex );
fGot = true;
}
else
{
WriteIndented( "," );
}
WriteIndented( " Op_{0}", opIndex );
}
}
if(fGot)
{
WriteLine();
}
}
//--//
foreach(IR.Operator op in bb.Operators)
{
DumpOperator( op );
}
m_indent -= 4;
m_indent -= 1;
WriteLine();
}
private void DumpOperator( IR.Operator op )
{
m_currentOperator = op;
string s = op.FormatOutput( this );
foreach(string s2 in s.Split( '\n' ))
{
WriteLine( "Op_{0,-4}: {1}", op.SpanningTreeIndex, s2 );
}
m_currentOperator = null;
}
//--//
private void WriteIndented( string s ,
params object[] args )
{
WriteIndentation();
m_writer.Append( FormatOutputInternal( s, args ) );
}
private void WriteIndentedLine( string s ,
params object[] args )
{
WriteIndentation();
m_writer.Append( FormatOutputInternal( s, args ) );
AddLine();
m_fIndented = false;
}
private void WriteIndentation()
{
if(m_fIndented == false)
{
m_fIndented = true;
for(int i = 0; i < m_indent; i++)
{
m_writer.Append( " " );
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRCompare/app.config
================================================
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/IRViewer.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{186F31A3-EF89-4A25-B2D5-20060721AA01}
WinExe
Properties
Microsoft.Zelig.Tools.IRViewer
Microsoft.Zelig.Tools.IRViewer
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
v4.5
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
AnyCPU
TRACE;DEBUG
false
false
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.dll
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.Drawing.dll
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.GraphViewerGDI.dll
3.5
Form
MainForm.cs
Designer
MainForm.cs
ResXFileCodeGenerator
Resources.Designer.cs
Designer
True
Resources.resx
True
SettingsSingleFileGenerator
Settings.Designer.cs
True
Settings.settings
True
{186F31A3-EF89-4A25-B2D5-20061218AA01}
Common
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/MainForm.Designer.cs
================================================
namespace Microsoft.Zelig.Tools.IRViewer
{
partial class MainForm
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose( bool disposing )
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.gViewer1 = new Microsoft.Glee.GraphViewerGdi.GViewer();
this.textBoxFilter = new System.Windows.Forms.TextBox();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.checkBoxShowLineNumbers = new System.Windows.Forms.CheckBox();
this.checkBoxExpandBasicBlocks = new System.Windows.Forms.CheckBox();
this.listViewVariables = new System.Windows.Forms.ListView();
this.columnHeaderVariableName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderVariableType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.listViewBasicBlock = new System.Windows.Forms.ListView();
this.columnHeaderOperatorIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderOperatorType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderOperatorValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.richTextBoxCode = new System.Windows.Forms.RichTextBox();
this.buttonLaunchCode = new System.Windows.Forms.Button();
this.textBoxCodeFileName = new System.Windows.Forms.TextBox();
this.listBoxMethods = new System.Windows.Forms.ListBox();
this.buttonBack = new System.Windows.Forms.Button();
this.contextMenuStripBackStack = new System.Windows.Forms.ContextMenuStrip(this.components);
this.buttonBackStackDropdown = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// openFileDialog1
//
this.openFileDialog1.Filter = "IR XML Dump|*.xml";
this.openFileDialog1.Title = "Open IR XML Dump";
//
// gViewer1
//
this.gViewer1.AsyncLayout = false;
this.gViewer1.AutoScroll = true;
this.gViewer1.BackwardEnabled = false;
this.gViewer1.Dock = System.Windows.Forms.DockStyle.Top;
this.gViewer1.EditObjects = false;
this.gViewer1.ForwardEnabled = false;
this.gViewer1.Graph = null;
this.gViewer1.Location = new System.Drawing.Point(0, 0);
this.gViewer1.MouseHitDistance = 0.05D;
this.gViewer1.Name = "gViewer1";
this.gViewer1.NavigationVisible = true;
this.gViewer1.PanButtonPressed = false;
this.gViewer1.SaveButtonVisible = true;
this.gViewer1.Size = new System.Drawing.Size(301, 562);
this.gViewer1.TabIndex = 0;
this.gViewer1.ZoomF = 1D;
this.gViewer1.ZoomFraction = 0.5D;
this.gViewer1.ZoomWindowThreshold = 0.05D;
this.gViewer1.SelectionChanged += new System.EventHandler(this.gViewer1_SelectionChanged);
this.gViewer1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.gViewer1_MouseClick);
//
// textBoxFilter
//
this.textBoxFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxFilter.Location = new System.Drawing.Point(67, 10);
this.textBoxFilter.Name = "textBoxFilter";
this.textBoxFilter.Size = new System.Drawing.Size(801, 20);
this.textBoxFilter.TabIndex = 1;
this.textBoxFilter.Click += new System.EventHandler(this.textBoxFilter_Click);
this.textBoxFilter.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged);
//
// splitContainer
//
this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer.Location = new System.Drawing.Point(12, 39);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.checkBoxShowLineNumbers);
this.splitContainer.Panel1.Controls.Add(this.gViewer1);
this.splitContainer.Panel1.Controls.Add(this.checkBoxExpandBasicBlocks);
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.listViewVariables);
this.splitContainer.Panel2.Controls.Add(this.listViewBasicBlock);
this.splitContainer.Panel2.Controls.Add(this.richTextBoxCode);
this.splitContainer.Panel2.Controls.Add(this.buttonLaunchCode);
this.splitContainer.Panel2.Controls.Add(this.textBoxCodeFileName);
this.splitContainer.Size = new System.Drawing.Size(856, 588);
this.splitContainer.SplitterDistance = 301;
this.splitContainer.TabIndex = 2;
//
// checkBoxShowLineNumbers
//
this.checkBoxShowLineNumbers.AutoSize = true;
this.checkBoxShowLineNumbers.Checked = true;
this.checkBoxShowLineNumbers.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxShowLineNumbers.Location = new System.Drawing.Point(136, 568);
this.checkBoxShowLineNumbers.Name = "checkBoxShowLineNumbers";
this.checkBoxShowLineNumbers.Size = new System.Drawing.Size(121, 17);
this.checkBoxShowLineNumbers.TabIndex = 4;
this.checkBoxShowLineNumbers.Text = "Show Line Numbers";
this.checkBoxShowLineNumbers.UseVisualStyleBackColor = true;
this.checkBoxShowLineNumbers.CheckedChanged += new System.EventHandler(this.checkBoxShowLineNumbers_CheckedChanged);
//
// checkBoxExpandBasicBlocks
//
this.checkBoxExpandBasicBlocks.AutoSize = true;
this.checkBoxExpandBasicBlocks.Location = new System.Drawing.Point(3, 568);
this.checkBoxExpandBasicBlocks.Name = "checkBoxExpandBasicBlocks";
this.checkBoxExpandBasicBlocks.Size = new System.Drawing.Size(126, 17);
this.checkBoxExpandBasicBlocks.TabIndex = 3;
this.checkBoxExpandBasicBlocks.Text = "Expand Basic Blocks";
this.checkBoxExpandBasicBlocks.UseVisualStyleBackColor = true;
this.checkBoxExpandBasicBlocks.CheckedChanged += new System.EventHandler(this.checkBoxExpandBasicBlocks_CheckedChanged);
//
// listViewVariables
//
this.listViewVariables.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderVariableName,
this.columnHeaderVariableType});
this.listViewVariables.Dock = System.Windows.Forms.DockStyle.Top;
this.listViewVariables.FullRowSelect = true;
this.listViewVariables.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listViewVariables.HideSelection = false;
this.listViewVariables.Location = new System.Drawing.Point(0, 0);
this.listViewVariables.Name = "listViewVariables";
this.listViewVariables.Size = new System.Drawing.Size(551, 150);
this.listViewVariables.TabIndex = 0;
this.listViewVariables.UseCompatibleStateImageBehavior = false;
this.listViewVariables.View = System.Windows.Forms.View.Details;
//
// columnHeaderVariableName
//
this.columnHeaderVariableName.Text = "Name";
this.columnHeaderVariableName.Width = 200;
//
// columnHeaderVariableType
//
this.columnHeaderVariableType.Text = "Type";
this.columnHeaderVariableType.Width = 340;
//
// listViewBasicBlock
//
this.listViewBasicBlock.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderOperatorIndex,
this.columnHeaderOperatorType,
this.columnHeaderOperatorValue});
this.listViewBasicBlock.FullRowSelect = true;
this.listViewBasicBlock.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listViewBasicBlock.HideSelection = false;
this.listViewBasicBlock.Location = new System.Drawing.Point(0, 153);
this.listViewBasicBlock.MultiSelect = false;
this.listViewBasicBlock.Name = "listViewBasicBlock";
this.listViewBasicBlock.ShowGroups = false;
this.listViewBasicBlock.Size = new System.Drawing.Size(551, 200);
this.listViewBasicBlock.TabIndex = 2;
this.listViewBasicBlock.UseCompatibleStateImageBehavior = false;
this.listViewBasicBlock.View = System.Windows.Forms.View.Details;
this.listViewBasicBlock.Click += new System.EventHandler(this.listViewBasicBlock_Click);
this.listViewBasicBlock.DoubleClick += new System.EventHandler(this.listViewBasicBlock_DoubleClick);
//
// columnHeaderOperatorIndex
//
this.columnHeaderOperatorIndex.Text = "#";
this.columnHeaderOperatorIndex.Width = 20;
//
// columnHeaderOperatorType
//
this.columnHeaderOperatorType.Text = "Operator";
this.columnHeaderOperatorType.Width = 150;
//
// columnHeaderOperatorValue
//
this.columnHeaderOperatorValue.Text = "Value";
this.columnHeaderOperatorValue.Width = 200;
//
// richTextBoxCode
//
this.richTextBoxCode.BackColor = System.Drawing.SystemColors.Window;
this.richTextBoxCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.richTextBoxCode.Dock = System.Windows.Forms.DockStyle.Bottom;
this.richTextBoxCode.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBoxCode.Location = new System.Drawing.Point(0, 379);
this.richTextBoxCode.Name = "richTextBoxCode";
this.richTextBoxCode.ReadOnly = true;
this.richTextBoxCode.Size = new System.Drawing.Size(551, 209);
this.richTextBoxCode.TabIndex = 1;
this.richTextBoxCode.Text = "";
this.richTextBoxCode.WordWrap = false;
//
// buttonLaunchCode
//
this.buttonLaunchCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLaunchCode.Enabled = false;
this.buttonLaunchCode.Location = new System.Drawing.Point(517, 356);
this.buttonLaunchCode.Name = "buttonLaunchCode";
this.buttonLaunchCode.Size = new System.Drawing.Size(34, 20);
this.buttonLaunchCode.TabIndex = 1;
this.buttonLaunchCode.Text = ">>";
this.buttonLaunchCode.UseVisualStyleBackColor = true;
this.buttonLaunchCode.Click += new System.EventHandler(this.buttonLaunchCode_Click);
//
// textBoxCodeFileName
//
this.textBoxCodeFileName.Location = new System.Drawing.Point(0, 356);
this.textBoxCodeFileName.Name = "textBoxCodeFileName";
this.textBoxCodeFileName.ReadOnly = true;
this.textBoxCodeFileName.Size = new System.Drawing.Size(514, 20);
this.textBoxCodeFileName.TabIndex = 0;
//
// listBoxMethods
//
this.listBoxMethods.FormattingEnabled = true;
this.listBoxMethods.Location = new System.Drawing.Point(67, 31);
this.listBoxMethods.Name = "listBoxMethods";
this.listBoxMethods.Size = new System.Drawing.Size(801, 212);
this.listBoxMethods.TabIndex = 0;
this.listBoxMethods.Click += new System.EventHandler(this.listBoxMethods_Click);
//
// buttonBack
//
this.buttonBack.Enabled = false;
this.buttonBack.Font = new System.Drawing.Font("Wingdings 3", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
this.buttonBack.Location = new System.Drawing.Point(12, 8);
this.buttonBack.Name = "buttonBack";
this.buttonBack.Size = new System.Drawing.Size(36, 24);
this.buttonBack.TabIndex = 3;
this.buttonBack.Text = "f";
this.buttonBack.UseVisualStyleBackColor = true;
this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
//
// contextMenuStripBackStack
//
this.contextMenuStripBackStack.Name = "contextMenuStripBackStack";
this.contextMenuStripBackStack.Size = new System.Drawing.Size(61, 4);
//
// buttonBackStackDropdown
//
this.buttonBackStackDropdown.Enabled = false;
this.buttonBackStackDropdown.Font = new System.Drawing.Font("Wingdings 3", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
this.buttonBackStackDropdown.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.buttonBackStackDropdown.Location = new System.Drawing.Point(47, 8);
this.buttonBackStackDropdown.Name = "buttonBackStackDropdown";
this.buttonBackStackDropdown.Size = new System.Drawing.Size(18, 24);
this.buttonBackStackDropdown.TabIndex = 5;
this.buttonBackStackDropdown.Text = "q";
this.buttonBackStackDropdown.UseVisualStyleBackColor = true;
this.buttonBackStackDropdown.Click += new System.EventHandler(this.buttonBackStackDropdown_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(880, 639);
this.Controls.Add(this.buttonBackStackDropdown);
this.Controls.Add(this.buttonBack);
this.Controls.Add(this.listBoxMethods);
this.Controls.Add(this.splitContainer);
this.Controls.Add(this.textBoxFilter);
this.MinimumSize = new System.Drawing.Size(896, 463);
this.Name = "MainForm";
this.Text = "IR Viewer";
this.Load += new System.EventHandler(this.MainForm_Load);
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout();
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private Microsoft.Glee.GraphViewerGdi.GViewer gViewer1;
private System.Windows.Forms.TextBox textBoxFilter;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.ListView listViewVariables;
private System.Windows.Forms.ColumnHeader columnHeaderVariableName;
private System.Windows.Forms.ColumnHeader columnHeaderVariableType;
private System.Windows.Forms.CheckBox checkBoxExpandBasicBlocks;
private System.Windows.Forms.RichTextBox richTextBoxCode;
private System.Windows.Forms.TextBox textBoxCodeFileName;
private System.Windows.Forms.Button buttonLaunchCode;
private System.Windows.Forms.ListView listViewBasicBlock;
private System.Windows.Forms.ColumnHeader columnHeaderOperatorIndex;
private System.Windows.Forms.ColumnHeader columnHeaderOperatorValue;
private System.Windows.Forms.ColumnHeader columnHeaderOperatorType;
private System.Windows.Forms.ListBox listBoxMethods;
private System.Windows.Forms.CheckBox checkBoxShowLineNumbers;
private System.Windows.Forms.Button buttonBack;
private System.Windows.Forms.ContextMenuStrip contextMenuStripBackStack;
private System.Windows.Forms.Button buttonBackStackDropdown;
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/MainForm.cs
================================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
namespace Microsoft.Zelig.Tools.IRViewer
{
public partial class MainForm : Form
{
//
// State
//
Dictionary m_lookupMethod;
Method m_method;
ListViewItem m_selectedOpLVI;
string m_phaseName;
bool m_fExpandBasicBlocks;
object m_highlightedObjectAttr;
object m_highlightedObject;
Glee.Drawing.NodeAttr m_selectedNodeAttr;
Glee.Drawing.Node m_selectedNode;
BasicBlock m_selectedBasicBlock;
SourceCodeTracker m_sourceCodeTracker;
struct BackStackState
{
public BackStackState(Method method, BasicBlock basicBlock, Operator op)
{
this.Method = method;
this.BasicBlock = basicBlock;
this.Operator = op;
}
public Method Method { get; }
public BasicBlock BasicBlock { get; }
public Operator Operator { get; }
}
Stack m_backStack;
//
// Constructor Methods
//
public MainForm()
{
m_sourceCodeTracker = new SourceCodeTracker();
m_backStack = new Stack();
m_fExpandBasicBlocks = false;
InitializeComponent();
UpdateListBox();
}
private void MainForm_Load(object sender, EventArgs e)
{
bool loadSucceeded = false;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(openFileDialog1.FileName);
var phaseName = Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
int idx = phaseName.LastIndexOf('.');
if (idx >= 0)
{
phaseName = phaseName.Substring(idx + 1, phaseName.Length - idx - 1);
}
this.Text = "IRViewer - " + phaseName;
foreach (System.Xml.XmlNode methods in doc.SelectNodes("Methods"))
{
Parser parser = new Parser(methods);
m_lookupMethod = parser.Methods;
m_phaseName = phaseName;
SelectMethod(null);
UpdateListBox();
textBoxFilter.Select();
loadSucceeded = true;
break;
}
}
catch
{
}
}
if (!loadSucceeded)
{
Close();
}
}
private void SelectMethod(Method method)
{
if (method == null)
{
Text = $"IRViewer - { m_phaseName }";
m_method = method;
}
else
{
Text = $"IRViewer - { method.Name } - { m_phaseName }";
if (m_method != null && m_method != method)
{
var previousOp = (m_selectedOpLVI != null) ? m_selectedBasicBlock.Operators[m_selectedOpLVI.Index] : null;
m_backStack.Push(new BackStackState(m_method, m_selectedBasicBlock, previousOp));
buttonBack.Enabled = true;
buttonBackStackDropdown.Enabled = true;
}
textBoxFilter.Text = method.Name;
listBoxMethods.Visible = false;
m_method = method;
CreateGraph();
ListVariables();
}
SelectBasicBlock(null);
}
//--//
private void CreateGraph()
{
Microsoft.Glee.Drawing.Graph g = new Microsoft.Glee.Drawing.Graph(string.Format("Method for {0}", m_method.Name));
g.GraphAttr.NodeAttr.Padding = 3;
foreach (BasicBlockEdge edge in m_method.BasicBlockEdges)
{
Microsoft.Glee.Drawing.Edge edgeG = g.AddEdge(edge.From.Id, edge.To.Id) as Microsoft.Glee.Drawing.Edge;
Microsoft.Glee.Drawing.EdgeAttr attr = edgeG.Attr;
attr.Label = edge.Kind;
attr.Fontsize -= 4;
}
foreach (BasicBlock bb in m_method.BasicBlocks)
{
Microsoft.Glee.Drawing.Node node = CreateNode(g, bb, m_fExpandBasicBlocks);
}
gViewer1.Graph = g;
m_selectedNode = null;
m_selectedNodeAttr = null;
m_highlightedObject = null;
m_highlightedObjectAttr = null;
}
private static Microsoft.Glee.Drawing.Node CreateNode(Microsoft.Glee.Drawing.Graph graph,
BasicBlock bb,
bool fExpandBasicBlocks)
{
Microsoft.Glee.Drawing.Node node = graph.AddNode(bb.Id) as Microsoft.Glee.Drawing.Node;
Microsoft.Glee.Drawing.NodeAttr attr = node.Attr;
if (bb.Type == "EntryBasicBlock")
{
attr.Shape = Microsoft.Glee.Drawing.Shape.Box;
attr.Fillcolor = Microsoft.Glee.Drawing.Color.Green;
}
else if (bb.Type == "ExitBasicBlock")
{
attr.Shape = Microsoft.Glee.Drawing.Shape.Box;
attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red;
}
else if (bb.Type == "ExceptionHandlerBasicBlock")
{
attr.Shape = Microsoft.Glee.Drawing.Shape.Box;
attr.Fillcolor = Microsoft.Glee.Drawing.Color.Purple;
}
else
{
attr.Shape = Microsoft.Glee.Drawing.Shape.Box;
}
if (fExpandBasicBlocks)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0}:", bb.Id);
sb.AppendLine();
foreach (Operator op in bb.Operators)
{
sb.AppendLine(op.Value);
}
node.Attr.Label = sb.ToString();
}
else
{
attr.Label = bb.Id + " - " + bb.Index;
}
return node;
}
//--//
private void ListVariables()
{
ListView.ListViewItemCollection col = listViewVariables.Items;
listViewVariables.SuspendLayout();
col.Clear();
foreach (Variable var in m_method.Variables)
{
ListViewItem lvi = new ListViewItem(var.Name);
lvi.SubItems.Add(var.Type);
col.Add(lvi);
}
listViewVariables.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
listViewVariables.ResumeLayout();
}
//--//--//
private void SelectBasicBlock(BasicBlock bb)
{
ListView.ListViewItemCollection col = listViewBasicBlock.Items;
listViewBasicBlock.SuspendLayout();
col.Clear();
m_selectedOpLVI = null;
m_selectedBasicBlock = bb;
if (bb != null)
{
foreach (Operator op in bb.Operators)
{
ListViewItem lvi = new ListViewItem(op.Index.ToString());
lvi.SubItems.Add(op.Type);
lvi.SubItems.Add(op.Value);
col.Add(lvi);
}
}
if (listViewBasicBlock.Items.Count > 0)
{
listViewBasicBlock.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
}
listViewBasicBlock.ResumeLayout();
if (listViewBasicBlock.Items.Count > 0)
{
listViewBasicBlock.Items[0].Selected = true;
listViewBasicBlock.Select();
}
UpdateCodePane();
}
//--//--//
private void gViewer1_SelectionChanged(object sender,
EventArgs e)
{
if (m_highlightedObject != null)
{
if (m_highlightedObject is Microsoft.Glee.Drawing.Edge)
{
Microsoft.Glee.Drawing.Edge edge = (Microsoft.Glee.Drawing.Edge)m_highlightedObject;
edge.Attr = m_highlightedObjectAttr as Microsoft.Glee.Drawing.EdgeAttr;
}
else if (m_highlightedObject is Microsoft.Glee.Drawing.Node)
{
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)m_highlightedObject;
node.Attr = m_highlightedObjectAttr as Microsoft.Glee.Drawing.NodeAttr;
}
m_highlightedObject = null;
m_highlightedObjectAttr = null;
}
if (gViewer1.SelectedObject != null)
{
m_highlightedObject = gViewer1.SelectedObject;
if (m_highlightedObject is Microsoft.Glee.Drawing.Edge)
{
Microsoft.Glee.Drawing.Edge edge = (Microsoft.Glee.Drawing.Edge)m_highlightedObject;
m_highlightedObjectAttr = edge.Attr.Clone();
edge.Attr.Color = Microsoft.Glee.Drawing.Color.Magenta;
edge.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Magenta;
}
else if (m_highlightedObject is Microsoft.Glee.Drawing.Node)
{
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)m_highlightedObject;
m_highlightedObjectAttr = node.Attr.Clone();
node.Attr.Color = Microsoft.Glee.Drawing.Color.Magenta;
node.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Magenta;
}
}
gViewer1.Invalidate();
}
private void gViewer1_MouseClick(object sender,
MouseEventArgs e)
{
// Do nothing if we didn't click on a node or click on the same node
if (m_highlightedObject is Microsoft.Glee.Drawing.Node && m_highlightedObject != m_selectedNode)
{
if (m_selectedNode != null)
{
m_selectedNode.Attr = m_selectedNodeAttr;
m_selectedNode = null;
m_selectedNodeAttr = null;
}
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)m_highlightedObject;
foreach (BasicBlock bb in m_method.BasicBlocks)
{
if (bb.Id == node.Id)
{
SelectBasicBlock(bb);
m_selectedNode = node;
// Save the original / untempered style so when we can go back to it when the node is unselected
m_selectedNodeAttr = ((Microsoft.Glee.Drawing.NodeAttr)m_highlightedObjectAttr).Clone();
// Apply the selected style to both the node and the saved styled from highlight so when
// mouse moves away, the node remain selected
((Microsoft.Glee.Drawing.NodeAttr)m_highlightedObjectAttr).Fillcolor = Microsoft.Glee.Drawing.Color.Goldenrod;
node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Goldenrod;
break;
}
}
gViewer1.Invalidate();
}
}
private void listViewBasicBlock_DoubleClick(object sender,
EventArgs e)
{
if (m_selectedBasicBlock != null && listViewBasicBlock.SelectedIndices.Count > 0)
{
int i = listViewBasicBlock.SelectedIndices[0];
if (i >= 0 && i < m_selectedBasicBlock.Operators.Count)
{
Operator op = m_selectedBasicBlock.Operators[i];
if (op.Call != null)
{
Method method;
if (m_lookupMethod.TryGetValue(op.Call, out method))
{
SelectMethod(method);
}
}
}
}
}
private void checkBoxExpandBasicBlocks_CheckedChanged(object sender,
EventArgs e)
{
m_fExpandBasicBlocks = checkBoxExpandBasicBlocks.Checked;
SelectBasicBlock(null);
CreateGraph();
}
private void listViewBasicBlock_Click(object sender, EventArgs e)
{
UpdateCodePane();
}
private void UpdateCodePane(bool force = false)
{
if (listViewBasicBlock.SelectedIndices.Count == 0)
{
ClearCodePane();
}
else
{
// Remove selection highlight on the list view item
if (m_selectedOpLVI != null)
{
m_selectedOpLVI.BackColor = listViewBasicBlock.BackColor;
m_selectedOpLVI.ForeColor = listViewBasicBlock.ForeColor;
}
var selectedOpLVI = listViewBasicBlock.SelectedItems[0];
var op = m_selectedBasicBlock.Operators[selectedOpLVI.Index];
var sourceCode = m_sourceCodeTracker.GetSourceCode(op?.Debug?.File);
if (sourceCode != null)
{
bool showLineNumbers = checkBoxShowLineNumbers.Checked;
int lineNumberPadding = showLineNumbers ? sourceCode.Count.ToString().Length + 2 : 0; // +2 for ": "
var previousOp = (m_selectedOpLVI != null) ? m_selectedBasicBlock.Operators[m_selectedOpLVI.Index] : null;
if (force || sourceCode.File != previousOp?.Debug?.File)
{
richTextBoxCode.Clear();
// Add the lines to the rich text box
if (showLineNumbers)
{
for (int i = 1; i <= sourceCode.Count; i++)
{
string lineNumberText = i.ToString();
richTextBoxCode.AppendText($"{new string(' ', lineNumberPadding - 2 - lineNumberText.Length)}{lineNumberText}: {sourceCode[i]}\r\n");
}
}
else
{
for (int i = 1; i <= sourceCode.Count; i++)
{
richTextBoxCode.AppendText($"{sourceCode[i]}\r\n");
}
}
textBoxCodeFileName.Text = op.Debug.File;
buttonLaunchCode.Enabled = true;
}
else if (previousOp != op)
{
// Remove previous highlighting
richTextBoxCode.SelectionStart = richTextBoxCode.GetFirstCharIndexFromLine(previousOp.Debug.BeginLine - 1);
richTextBoxCode.SelectionLength =
richTextBoxCode.GetFirstCharIndexFromLine(previousOp.Debug.EndLine - 1) +
richTextBoxCode.Lines[previousOp.Debug.EndLine - 1].Length - richTextBoxCode.SelectionStart;
richTextBoxCode.SelectionBackColor = richTextBoxCode.BackColor;
}
if (force || previousOp != op)
{
// Highlight the relevant lines
int beginLineCharIndex = richTextBoxCode.GetFirstCharIndexFromLine(op.Debug.BeginLine - 1);
int endLineCharIndex = richTextBoxCode.GetFirstCharIndexFromLine(op.Debug.EndLine - 1);
richTextBoxCode.SelectionStart = beginLineCharIndex;
richTextBoxCode.SelectionLength =
endLineCharIndex + richTextBoxCode.Lines[op.Debug.EndLine - 1].Length - richTextBoxCode.SelectionStart;
richTextBoxCode.SelectionBackColor = Color.PaleGoldenrod;
// Highlight the relevant columns
richTextBoxCode.SelectionStart = beginLineCharIndex + lineNumberPadding + op.Debug.BeginColumn - 1;
richTextBoxCode.SelectionLength = endLineCharIndex + lineNumberPadding + op.Debug.EndColumn - richTextBoxCode.SelectionStart;
richTextBoxCode.SelectionBackColor = Color.Goldenrod;
}
// Scroll to a few lines before the start
int scrollLineTarget = op.Debug.BeginLine - 4;
if (scrollLineTarget < 0)
{
scrollLineTarget = 0;
}
richTextBoxCode.SelectionStart = richTextBoxCode.GetFirstCharIndexFromLine(scrollLineTarget);
richTextBoxCode.SelectionLength = 0;
richTextBoxCode.ScrollToCaret();
}
else
{
textBoxCodeFileName.Clear();
richTextBoxCode.Clear();
richTextBoxCode.AppendText("//\r\n// No corresponding source code\r\n//\r\n");
buttonLaunchCode.Enabled = false;
}
// Override the selected LVI with the highlight color so it remain "highlighted" when losing focus.
selectedOpLVI.BackColor = SystemColors.Highlight;
selectedOpLVI.ForeColor = SystemColors.HighlightText;
m_selectedOpLVI = selectedOpLVI;
}
}
private void ClearCodePane()
{
richTextBoxCode.Clear();
textBoxCodeFileName.Clear();
buttonLaunchCode.Enabled = false;
m_selectedOpLVI = null;
}
private void MainForm_Resize(object sender, EventArgs e)
{
const int margin = 3;
listViewBasicBlock.Height = splitContainer.Panel2.Height - listViewVariables.Height - richTextBoxCode.Height - buttonLaunchCode.Height - margin * 3;
listViewBasicBlock.Width = splitContainer.Panel2.Width;
textBoxCodeFileName.Top = listViewBasicBlock.Bottom + margin;
textBoxCodeFileName.Width = splitContainer.Panel2.Width - buttonLaunchCode.Width - margin;
buttonLaunchCode.Top = listViewBasicBlock.Bottom + margin;
buttonLaunchCode.Left = textBoxCodeFileName.Right + margin;
gViewer1.Height = splitContainer.Panel1.Height - checkBoxExpandBasicBlocks.Height - margin;
checkBoxExpandBasicBlocks.Top = gViewer1.Bottom + margin;
checkBoxShowLineNumbers.Top = gViewer1.Bottom + margin;
listBoxMethods.Width = textBoxFilter.Width;
}
private void buttonLaunchCode_Click(object sender, EventArgs e)
{
try
{
Process.Start(textBoxCodeFileName.Text);
}
catch
{
// ignored
}
}
private void textBoxFilter_TextChanged(object sender,
EventArgs e)
{
UpdateListBox();
}
private void UpdateListBox()
{
if (m_lookupMethod != null)
{
string filter = textBoxFilter.Text.ToLower();
List lst = new List();
foreach (string id in m_lookupMethod.Keys)
{
if (string.IsNullOrEmpty(filter) || id.ToLower().Contains(filter))
{
lst.Add(id);
}
}
lst.Sort();
ListBox.ObjectCollection col = listBoxMethods.Items;
listBoxMethods.SuspendLayout();
col.Clear();
col.AddRange(lst.ToArray());
listBoxMethods.ResumeLayout();
listBoxMethods.Visible = listBoxMethods.Items.Count > 0;
}
}
private void listBoxMethods_Click(object sender, EventArgs e)
{
if (m_lookupMethod != null)
{
if (listBoxMethods.SelectedItem != null)
{
SelectMethod(m_lookupMethod[(string)listBoxMethods.SelectedItem]);
}
}
}
private void textBoxFilter_Click(object sender, EventArgs e)
{
textBoxFilter.SelectAll();
listBoxMethods.Visible = listBoxMethods.Items.Count > 0;
if (listBoxMethods.Visible)
{
listBoxMethods.SelectedIndex = -1;
}
}
private void checkBoxShowLineNumbers_CheckedChanged(object sender, EventArgs e)
{
UpdateCodePane(/*force*/true);
}
private void buttonBack_Click(object sender, EventArgs e)
{
if (m_backStack.Count > 0)
{
GoBack(m_backStack.Pop());
}
}
private void buttonBackStackDropdown_Click(object sender, EventArgs e)
{
if (m_backStack.Count > 0)
{
contextMenuStripBackStack.Items.Clear();
foreach (var item in m_backStack)
{
contextMenuStripBackStack.Items.Add(item.Method.Name, null, new EventHandler(delegate (object o, EventArgs a)
{
BackStackState state;
do
{
state = m_backStack.Pop();
} while (!state.Equals(item));
GoBack(state);
}));
}
contextMenuStripBackStack.Show(buttonBack, new Point(0, buttonBack.Height));
}
}
private void GoBack(BackStackState state)
{
// Select the method
m_method = state.Method;
textBoxFilter.Text = m_method.Name;
listBoxMethods.Visible = false;
CreateGraph();
ListVariables();
// Select the basic block
SelectBasicBlock(state.BasicBlock);
if (state.BasicBlock != null)
{
// Select the node in graph
var node = gViewer1.Graph.FindNode(state.BasicBlock.Id);
if (node != null)
{
m_selectedNode = node;
m_selectedNodeAttr = node.Attr.Clone();
node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Goldenrod;
gViewer1.Invalidate();
}
// Select the operation
var lvi = listViewBasicBlock.FindItemWithText(state.Operator.Index.ToString(), /*includesSubItem*/false, /*startIndex*/0, /*prefixSearch*/false);
if (lvi != null)
{
lvi.Selected = true;
listViewBasicBlock.Select();
UpdateCodePane();
}
}
if (m_backStack.Count == 0)
{
buttonBack.Enabled = false;
buttonBackStackDropdown.Enabled = false;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/MainForm.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126, 17
266, 17
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Parser.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.IRViewer
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
public class Method
{
//
// State
//
public string Name;
public List< Variable > Variables = new List< Variable >();
public List< BasicBlock > BasicBlocks = new List< BasicBlock >();
public List< BasicBlockEdge > BasicBlockEdges = new List< BasicBlockEdge >();
}
public class Variable
{
//
// State
//
public string Name;
public string Type;
}
public class BasicBlock
{
//
// State
//
public string Id;
public string Index;
public string Type;
public List< Operator > Operators = new List< Operator >();
public List< ReachingDefinition > ReachingDefinitions = new List< ReachingDefinition >();
public List< HandlerFor > Handlers = new List< HandlerFor >();
}
public class ReachingDefinition
{
//
// State
//
public string Variable;
public List< Operator > Definitions = new List< Operator >();
}
public class HandlerFor
{
//
// State
//
public string Eh;
}
public class Operator
{
//
// State
//
public int Index;
public string Type;
public string Value;
public string Call;
public Debug Debug;
}
public class Debug
{
//
// State
//
public string File;
public int BeginLine;
public int BeginColumn;
public int EndLine;
public int EndColumn;
}
public class BasicBlockEdge
{
//
// State
//
public BasicBlock From;
public BasicBlock To;
public string Kind;
}
public class Parser
{
//
// State
//
private Dictionary< string, Method > m_methods = new Dictionary< string, Method >();
//
// Constructor Methods
//
public Parser( XmlNode node )
{
foreach(XmlNode subnode in node.SelectNodes( "Method" ))
{
Method res = ParseMethod( subnode );
m_methods[ res.Name ] = res;
}
}
public Dictionary< string, Method > Methods
{
get
{
return m_methods;
}
}
//--//
private Method ParseMethod( XmlNode node )
{
Method res = new Method();
res.Name = GetAttribute( node, "Name" );
foreach(XmlNode subnode in node.SelectNodes( "Variable" ))
{
res.Variables.Add( ParseVariable( subnode ) );
}
Dictionary< string, BasicBlock > lookupBasicBlock = new Dictionary< string, BasicBlock >();
Dictionary< string, XmlNode > lookupNode = new Dictionary< string, XmlNode >();
Dictionary< int , Operator > lookupOperator = new Dictionary< int , Operator >();
foreach(XmlNode subnode in node.SelectNodes( "BasicBlock" ))
{
res.BasicBlocks.Add( ParseBasicBlock( subnode, lookupBasicBlock, lookupNode, lookupOperator ) );
}
foreach(string id in lookupNode.Keys)
{
BasicBlock bb = lookupBasicBlock[ id ];
XmlNode subnode = lookupNode [ id ];
ParseBasicBlock( subnode, res, bb, lookupBasicBlock, lookupOperator );
}
return res;
}
private Variable ParseVariable( XmlNode node )
{
Variable res = new Variable();
res.Name = GetAttribute( node, "Name" );
res.Type = GetAttribute( node, "Type" );
return res;
}
private BasicBlock ParseBasicBlock( XmlNode node ,
Dictionary< string, BasicBlock > lookupBasicBlock ,
Dictionary< string, XmlNode > lookupNode ,
Dictionary< int , Operator > lookupOperator )
{
BasicBlock res = new BasicBlock();
res.Id = GetAttribute( node, "Id" );
res.Index = GetAttribute( node, "Index" );
res.Type = GetAttribute( node, "Type" );
lookupBasicBlock[ res.Id ] = res;
lookupNode [ res.Id ] = node;
foreach(XmlNode subnode in node.SelectNodes( "Operator" ))
{
res.Operators.Add( ParseOperator( subnode, lookupOperator ) );
}
return res;
}
private Operator ParseOperator( XmlNode node ,
Dictionary< int, Operator > lookupOperator )
{
Operator res = new Operator();
res.Index = int.Parse( GetAttribute( node, "Index" ) );
res.Call = GetAttribute( node, "Call" );
res.Type = GetAttribute(node, "Type");
res.Value = node.InnerText;
XmlNode subnode = node.SelectSingleNode( "Debug" );
if(subnode != null)
{
res.Debug = ParseDebug( subnode );
}
lookupOperator[ res.Index ] = res;
return res;
}
private Debug ParseDebug( XmlNode node )
{
Debug res = new Debug();
res.File = GetAttribute( node, "File" );
res.BeginLine = int.Parse( GetAttribute( node, "BeginLine" ) );
res.BeginColumn = int.Parse( GetAttribute( node, "BeginColumn" ) );
res.EndLine = int.Parse( GetAttribute( node, "EndLine" ) );
res.EndColumn = int.Parse( GetAttribute( node, "EndColumn" ) );
return res;
}
private void ParseBasicBlock( XmlNode node ,
Method method ,
BasicBlock bb ,
Dictionary< string, BasicBlock > lookupBasicBlock ,
Dictionary< int, Operator > lookupOperator )
{
foreach(XmlNode subnode in node.SelectNodes( "ReachingDefinition" ))
{
bb.ReachingDefinitions.Add( ParseReachingDefinition( subnode, lookupOperator ) );
}
foreach(XmlNode subnode in node.SelectNodes( "HandlerFor" ))
{
bb.Handlers.Add( ParseHandler( subnode ) );
}
foreach(XmlNode subnode in node.SelectNodes( "Edge" ))
{
method.BasicBlockEdges.Add( ParseBasicBlockEdge( subnode, lookupBasicBlock ) );
}
}
private ReachingDefinition ParseReachingDefinition( XmlNode node ,
Dictionary< int, Operator > lookupOperator )
{
ReachingDefinition res = new ReachingDefinition();
res.Variable = GetAttribute( node, "Variable" );
foreach(XmlNode subnode in node.SelectNodes( "Definition" ))
{
res.Definitions.Add( lookupOperator[ int.Parse( GetAttribute( subnode, "Index" ) ) ] );
}
return res;
}
private HandlerFor ParseHandler( XmlNode node )
{
HandlerFor res = new HandlerFor();
res.Eh = GetAttribute( node, "Type" );
return res;
}
private BasicBlockEdge ParseBasicBlockEdge( XmlNode node ,
Dictionary< string, BasicBlock > lookupBasicBlock )
{
BasicBlockEdge res = new BasicBlockEdge();
res.From = lookupBasicBlock[ GetAttribute( node, "From" ) ];
res.To = lookupBasicBlock[ GetAttribute( node, "To" ) ];
res.Kind = GetAttribute( node, "Kind" ) ;
return res;
}
//--//
private static string GetAttribute( XmlNode node ,
string name )
{
XmlAttribute attrib = node.Attributes.GetNamedItem( name ) as XmlAttribute ;
if(attrib != null)
{
return attrib.Value;
}
return null;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Program.cs
================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Microsoft.Zelig.Tools.IRViewer
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new MainForm() );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "IRViewer" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "IRViewer" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2006" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
//// The following GUID is for the ID of the typelib if this project is exposed to COM
//[assembly: Guid( "fafaa296-9d0d-42fa-b922-8fb69f2544b2" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Properties/Resources.Designer.cs
================================================
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace Microsoft.Zelig.Tools.IRViewer.Properties {
using System;
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Zelig.Tools.IRViewer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Properties/Resources.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Properties/Settings.Designer.cs
================================================
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace Microsoft.Zelig.Tools.IRViewer.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/Properties/Settings.settings
================================================
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/IRViewer/SourceCodeTracker.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.IRViewer
{
using System;
using System.Collections.Generic;
public sealed class SourceCodeTracker
{
public sealed class SourceCode
{
readonly List _lines;
public SourceCode(string file)
{
File = file;
_lines = new List();
using (var stream = new System.IO.StreamReader(file))
{
string line;
while ((line = stream.ReadLine()) != null)
{
_lines.Add(line);
}
}
}
public string File { get; }
public int Count => _lines.Count;
public string this[int line]
{
get
{
if (line >= 1 && line <= _lines.Count)
{
return _lines[line - 1];
}
return string.Empty;
}
}
}
GrowOnlyHashTable _lookupSourceCode;
public SourceCodeTracker()
{
_lookupSourceCode = HashTableFactory.New();
}
public SourceCode GetSourceCode(string file)
{
SourceCode sc = null;
if (_lookupSourceCode.TryGetValue(file, out sc))
{
return sc;
}
if (System.IO.File.Exists(file))
{
try
{
sc = new SourceCode(file);
}
catch
{
// ignored
}
}
_lookupSourceCode[file] = sc;
return sc;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/GraphForm.Designer.cs
================================================
namespace Microsoft.Zelig.Tools.InequalityGraphVisualization
{
partial class GraphForm
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose( bool disposing )
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.gViewer1 = new Microsoft.Glee.GraphViewerGdi.GViewer();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
this.textBox1 = new System.Windows.Forms.TextBox();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point( 0, 0 );
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add( this.splitContainer2 );
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add( this.richTextBox1 );
this.splitContainer1.Size = new System.Drawing.Size( 1171, 738 );
this.splitContainer1.SplitterDistance = 634;
this.splitContainer1.TabIndex = 0;
//
// gViewer1
//
this.gViewer1.AsyncLayout = false;
this.gViewer1.AutoScroll = true;
this.gViewer1.BackwardEnabled = false;
this.gViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gViewer1.EditObjects = false;
this.gViewer1.ForwardEnabled = false;
this.gViewer1.Graph = null;
this.gViewer1.Location = new System.Drawing.Point( 0, 0 );
this.gViewer1.MouseHitDistance = 0.05;
this.gViewer1.Name = "gViewer1";
this.gViewer1.NavigationVisible = true;
this.gViewer1.PanButtonPressed = false;
this.gViewer1.SaveButtonVisible = false;
this.gViewer1.Size = new System.Drawing.Size( 1171, 593 );
this.gViewer1.TabIndex = 1;
this.gViewer1.ZoomF = 1;
this.gViewer1.ZoomFraction = 0.5;
this.gViewer1.ZoomWindowThreshold = 0.05;
this.gViewer1.SelectionChanged += new System.EventHandler( this.gViewer1_SelectionChanged );
this.gViewer1.MouseClick += new System.Windows.Forms.MouseEventHandler( this.gViewer1_MouseClick );
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point( 0, 0 );
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size( 1171, 100 );
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point( 0, 0 );
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add( this.textBox1 );
this.splitContainer2.Panel1.Controls.Add( this.hScrollBar1 );
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add( this.gViewer1 );
this.splitContainer2.Size = new System.Drawing.Size( 1171, 634 );
this.splitContainer2.SplitterDistance = 40;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 2;
//
// hScrollBar1
//
this.hScrollBar1.Location = new System.Drawing.Point( 9, 9 );
this.hScrollBar1.Name = "hScrollBar1";
this.hScrollBar1.Size = new System.Drawing.Size( 235, 20 );
this.hScrollBar1.TabIndex = 0;
this.hScrollBar1.ValueChanged += new System.EventHandler( this.hScrollBar1_ValueChanged );
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point( 248, 9 );
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size( 911, 20 );
this.textBox1.TabIndex = 1;
//
// GraphForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size( 1171, 738 );
this.Controls.Add( this.splitContainer1 );
this.Name = "GraphForm";
this.Text = "Inequality Graph Viewer";
this.Load += new System.EventHandler( this.GraphForm_Load );
this.splitContainer1.Panel1.ResumeLayout( false );
this.splitContainer1.Panel2.ResumeLayout( false );
this.splitContainer1.ResumeLayout( false );
this.splitContainer2.Panel1.ResumeLayout( false );
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout( false );
this.splitContainer2.ResumeLayout( false );
this.ResumeLayout( false );
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private Microsoft.Glee.GraphViewerGdi.GViewer gViewer1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.HScrollBar hScrollBar1;
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/GraphForm.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.InequalityGraphVisualization
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Zelig.CodeGeneration.IR;
using Microsoft.Zelig.CodeGeneration.IR.Transformations;
public partial class GraphForm : Form
{
//
// State
//
ConstraintSystemCollector.GraphState m_gs;
GrowOnlyHashTable< object, string > m_ids = HashTableFactory.New< object, string >();
object m_selectedObjectAttr;
object m_selectedObject;
//
// Constructor Methods
//
public GraphForm( ConstraintSystemCollector.GraphState gs )
{
m_gs = gs;
InitializeComponent();
}
//
// Helper Methods
//
private void CreateGraph()
{
Microsoft.Glee.Drawing.Graph g = new Microsoft.Glee.Drawing.Graph( "None" );
g.GraphAttr.NodeAttr.Padding = 3;
foreach(object obj in m_gs.Vertices.Keys)
{
if(m_gs.WasReached( obj ))
{
Microsoft.Glee.Drawing.Node node = CreateNode( g, obj );
}
}
foreach(ConstraintSystemCollector.ConstraintInstance ci in m_gs.Constraints)
{
if(m_gs.WasReached( ci.Destination ) &&
m_gs.WasReached( ci.Source ) )
{
Microsoft.Glee.Drawing.Edge edgeG = CreateEdge( g, ci );
}
}
gViewer1.Graph = g;
if(m_gs.ProofTests != null)
{
hScrollBar1.Minimum = 0;
hScrollBar1.Maximum = m_gs.ProofTests.Count - 1 + hScrollBar1.LargeChange;
}
}
private Microsoft.Glee.Drawing.Edge CreateEdge( Microsoft.Glee.Drawing.Graph graph ,
ConstraintSystemCollector.ConstraintInstance ci )
{
Microsoft.Glee.Drawing.Edge edge = graph.AddEdge( GetId( ci.Source ), GetId( ci.Destination ) ) as Microsoft.Glee.Drawing.Edge;
Microsoft.Glee.Drawing.EdgeAttr attr = edge.Attr;
edge.UserData = ci;
attr.ArrowHeadAtTarget = Microsoft.Glee.Drawing.ArrowStyle.Normal;
attr.Label = ci.Weight.ToString();
//// attr.Fontsize -= 4;
return edge;
}
private Microsoft.Glee.Drawing.Node CreateNode( Microsoft.Glee.Drawing.Graph graph ,
object obj )
{
Microsoft.Glee.Drawing.Node node = graph.AddNode( GetId( obj ) ) as Microsoft.Glee.Drawing.Node;
Microsoft.Glee.Drawing.NodeAttr attr = node.Attr;
attr.Label = GetLabel( obj );
Operator op = m_gs.Vertices[obj];
if(op is PhiOperator)
{
attr.Shape = Microsoft.Glee.Drawing.Shape.Diamond;
}
else if(op is PiOperator)
{
attr.Shape = Microsoft.Glee.Drawing.Shape.DoubleCircle;
}
node.UserData = obj;
return node;
}
private Microsoft.Glee.Drawing.Node GetNode( object obj )
{
string id = GetId( obj );
return gViewer1.Graph.FindNode( id );
}
private void SetColor( object obj ,
Microsoft.Glee.Drawing.Color color )
{
SetColorForNode( GetNode( obj ), color );
}
private void SetColorForNode( Microsoft.Glee.Drawing.Node node ,
Microsoft.Glee.Drawing.Color color )
{
Microsoft.Glee.Drawing.NodeAttr nodeAttr = node.Attr;
nodeAttr.Color = color;
nodeAttr.Fontcolor = color;
nodeAttr.Fillcolor = Microsoft.Glee.Drawing.Color.White;
}
private string GetId( object obj )
{
string id;
if(m_ids.TryGetValue( obj, out id ) == false)
{
id = string.Format( "Id{0}", m_ids.Count );
m_ids[obj] = id;
}
return id;
}
private string GetLabel( object obj )
{
string res;
if(m_gs.Labels.TryGetValue( obj, out res ) == false)
{
res = obj.ToString();
}
return res;
}
//--//
private void ClearText()
{
richTextBox1.Clear();
}
private void AppendText( string fmt ,
params object[] args )
{
richTextBox1.AppendText( string.Format( fmt, args ) );
richTextBox1.AppendText( "\n" );
}
//
// Event Methods
//
private void GraphForm_Load( object sender ,
EventArgs e )
{
CreateGraph();
}
private void gViewer1_SelectionChanged( object sender ,
EventArgs e )
{
if(m_selectedObject != null)
{
if(m_selectedObject is Microsoft.Glee.Drawing.Edge)
{
Microsoft.Glee.Drawing.Edge edge = (Microsoft.Glee.Drawing.Edge)m_selectedObject;
edge.Attr = m_selectedObjectAttr as Microsoft.Glee.Drawing.EdgeAttr;
}
else if(m_selectedObject is Microsoft.Glee.Drawing.Node)
{
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)m_selectedObject;
node.Attr = m_selectedObjectAttr as Microsoft.Glee.Drawing.NodeAttr;
}
m_selectedObject = null;
m_selectedObjectAttr = null;
}
if(gViewer1.SelectedObject == null)
{
//// label1.Text = "No object under the mouse";
//// this.gViewer.SetToolTip( toolTip1, "" );
}
else
{
m_selectedObject = gViewer1.SelectedObject;
if(m_selectedObject is Microsoft.Glee.Drawing.Edge)
{
Microsoft.Glee.Drawing.Edge edge = (Microsoft.Glee.Drawing.Edge)m_selectedObject;
m_selectedObjectAttr = edge.Attr.Clone();
edge.Attr.Color = Microsoft.Glee.Drawing.Color.Magenta;
edge.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Magenta;
//// //here you can use e.Attr.Id or e.UserData to get back to you data
//// this.gViewer.SetToolTip( this.toolTip1, String.Format( "edge from {0} {1}", edge.Source, edge.Target ) );
}
else if(m_selectedObject is Microsoft.Glee.Drawing.Node)
{
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)m_selectedObject;
m_selectedObjectAttr = node.Attr.Clone();
node.Attr.Color = Microsoft.Glee.Drawing.Color.Magenta;
node.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Magenta;
//// //here you can use e.Attr.Id to get back to your data
//// this.gViewer.SetToolTip( toolTip1, String.Format( "node {0}", (selectedObject as Node).Attr.Label ) );
}
}
gViewer1.Invalidate();
}
private void gViewer1_MouseClick( object sender ,
MouseEventArgs e )
{
ClearText();
richTextBox1.Clear();
if(gViewer1.SelectedObject is Microsoft.Glee.Drawing.Edge)
{
Microsoft.Glee.Drawing.Edge edge = (Microsoft.Glee.Drawing.Edge)gViewer1.SelectedObject;
ConstraintSystemCollector.ConstraintInstance ci = (ConstraintSystemCollector.ConstraintInstance)edge.UserData;
AppendText( "Constraint: {0} - {1} <= {2}", GetLabel( ci.Destination ), GetLabel( ci.Source ), ci.Weight );
}
if(gViewer1.SelectedObject is Microsoft.Glee.Drawing.Node)
{
Microsoft.Glee.Drawing.Node node = (Microsoft.Glee.Drawing.Node)gViewer1.SelectedObject;
object obj = node.UserData;
if(obj is ConstraintSystemCollector.ArrayLengthHolder)
{
ConstraintSystemCollector.ArrayLengthHolder hld = (ConstraintSystemCollector.ArrayLengthHolder)obj;
obj = hld.Array;
}
AppendText( "Symbol: {0} = {1}", GetLabel( obj ), obj );
Operator op;
if(m_gs.Vertices.TryGetValue( obj, out op ) && op != null)
{
AppendText( "Definition: {0} is Op_{1} : {2}", GetLabel( obj ), op.SpanningTreeIndex, op.ToPrettyString() );
Operator opStart = op;
Operator opStop = op;
for(int i = 0; i < 3; i++)
{
Operator op2 = opStart.GetPreviousOperator();
if(op2 == null)
{
break;
}
opStart = op2;
}
for(int i = 0; i < 3; i++)
{
Operator op2 = opStop.GetNextOperator();
if(op2 == null)
{
break;
}
opStop = op2;
}
Operator[] ops = op.BasicBlock.Operators;
int start = ArrayUtility.FindInNotNullArray( ops, opStart );
int stop = ArrayUtility.FindInNotNullArray( ops, opStop );
AppendText( "----" );
while(start <= stop)
{
Operator op2 = ops[start++];
AppendText( "Op_{0}: {1}", op2.SpanningTreeIndex, op2.ToPrettyString() );
}
}
}
}
private void hScrollBar1_ValueChanged( object sender ,
EventArgs e )
{
if(m_gs.ProofTests != null)
{
Stack< ConstraintSystemCollector.ConstraintInstance > stack = new Stack< ConstraintSystemCollector.ConstraintInstance >();
System.Text.StringBuilder sb = new StringBuilder();
string dir = (m_gs.Flavor == ConstraintSystemCollector.Kind.LessThanOrEqual) ? "<=" : ">=";
for(int i = 0; i < hScrollBar1.Value; i++)
{
object val = m_gs.ProofTests[i];
if(val is ConstraintSystemCollector.ConstraintInstance)
{
var ci = val as ConstraintSystemCollector.ConstraintInstance;
stack.Push( ci );
SetColor( ci.Source , Microsoft.Glee.Drawing.Color.Blue );
SetColor( ci.Destination, Microsoft.Glee.Drawing.Color.Brown );
sb.AppendFormat( "Checking: ## {0} {1} ## - ## {2} {3} ## {4} {5}\n", GetLabel( ci.Destination ), ci.Destination, GetLabel( ci.Source ), ci.Source, m_gs.Flavor == ConstraintSystemCollector.Kind.LessThanOrEqual ? "<=" : ">=", ci.Weight );
}
else if(val is ConstraintSystemCollector.Lattice)
{
var res = (ConstraintSystemCollector.Lattice)val;
if(stack.Count > 0)
{
var ci = stack.Pop();
switch(res)
{
case ConstraintSystemCollector.Lattice.True:
SetColor( ci.Destination, Microsoft.Glee.Drawing.Color.Green );
break;
case ConstraintSystemCollector.Lattice.Reduced:
SetColor( ci.Destination, Microsoft.Glee.Drawing.Color.Orange );
break;
case ConstraintSystemCollector.Lattice.False:
SetColor( ci.Destination, Microsoft.Glee.Drawing.Color.Red );
break;
}
sb.AppendFormat( "Result: ## {0} {1} ## - ## {2} {3} ## {4} {5} ==> {6}\n", GetLabel( ci.Destination ), ci.Destination, GetLabel( ci.Source ), ci.Source, dir, ci.Weight, res );
}
}
else
{
foreach(Microsoft.Glee.Drawing.Node node in gViewer1.Graph.NodeMap.Values)
{
SetColorForNode( node, Microsoft.Glee.Drawing.Color.Black );
}
sb.Length = 0;
}
}
var ciArray = stack.ToArray();
for(int i = ciArray.Length; --i >= 0;)
{
var ci = ciArray[i];
var node = GetNode( ci.Destination );
if(i == 0)
{
node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGreen;
textBox1.Text = string.Format( "Step: {0}, trying to prove {1} {2} {3} {4}", hScrollBar1.Value, GetLabel( ci.Destination ), GetLabel( ci.Source ), dir, ci.Weight );
}
else
{
node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGray;
}
}
richTextBox1.Clear();
richTextBox1.AppendText( sb.ToString() );
richTextBox1.ScrollToCaret();
gViewer1.Refresh();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/GraphForm.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
True
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/InequalityGraphVisualization.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{96BF0234-1D60-4401-A6B9-99839187234E}
Library
Properties
Microsoft.Zelig.Tools.InequalityGraphVisualization
Microsoft.Zelig.Tools.InequalityGraphVisualization
v4.5
512
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
AllRules.ruleset
AnyCPU
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE;DEBUG
AnyCPU
false
false
False
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.dll
False
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.Drawing.dll
False
..\..\..\External\Binaries\GLEE\Debug\Microsoft.GLEE.GraphViewerGDI.dll
3.5
Form
GraphForm.cs
GraphForm.cs
Designer
{186F31A3-EF89-4A25-B2D5-20061218AA01}
Common
False
{186F31A3-EF89-4A25-B2D5-20060720AA01}
TypeSystem
False
{186F31A3-EF89-4A25-B2D5-20070222AA01}
CodeTransformation
False
{186F31A3-EF89-4A25-B2D5-20060603AA01}
IntermediateRepresentation
False
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "Microsoft.Zelig.Tools.InequalityGraphVisualization" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "InequalityGraphVisualization" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2007" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "f330d684-c05e-4db4-b064-fd3156fa8e7c" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: Zelig/Zelig/CompileTime/AnalysisTools/InequalityGraphVisualization/Viewer.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Tools.InequalityGraphVisualization
{
using System;
using System.Threading;
using System.Collections.Generic;
using System.Windows.Forms;
using Microsoft.Zelig.CodeGeneration.IR;
using Microsoft.Zelig.CodeGeneration.IR.Transformations;
public class Viewer
{
//
// State
//
static bool s_Initialized;
//
// Helper Methods
//
[STAThread]
public static void Show( ConstraintSystemCollector.GraphState gs )
{
if(!s_Initialized)
{
s_Initialized = true;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
}
Application.Run( new GraphForm( gs ) );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/BaseTester.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#define LIVE
//#define REDIRECT_OUTPUT
//#define DUMP_SINGLE_METHOD
//#define USE_IMOTE_PLATFORM
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Zelig.MetaData;
using Importer = Microsoft.Zelig.MetaData.Importer;
using Normalized = Microsoft.Zelig.MetaData.Normalized;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using RT = Microsoft.Zelig.Runtime;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
#if REDIRECT_OUTPUT
internal class RedirectOutput : IDisposable
{
System.IO.TextWriter m_orig;
System.IO.TextWriter m_writer;
internal RedirectOutput( string file )
{
m_orig = Console.Out;
m_writer = new System.IO.StreamWriter( file, false, System.Text.Encoding.ASCII );
Console.SetOut( m_writer );
}
public void Dispose()
{
Console.SetOut( m_orig );
m_writer.Close();
}
}
#else
internal class RedirectOutput : IDisposable
{
internal RedirectOutput( string file )
{
}
public void Dispose()
{
}
}
#endif
public abstract class BaseTester :
TS.IEnvironmentProvider
{
public class TypeSystemForUnitTest : IR.TypeSystemForCodeTransformation
{
//
// State
//
BaseTester m_owner;
//
// Constructor Methods
//
public TypeSystemForUnitTest( BaseTester owner ,
TS.IEnvironmentProvider env ) : base( env )
{
m_owner = owner;
}
//
// Helper Methods
//
protected override void NotifyCompilationPhase( IR.CompilationSteps.PhaseDriver phase )
{
m_owner.NotifyCompilationPhase( phase );
}
}
#if LIVE
protected static string BuildRoot = Expand( @"%DEPOTROOT%\ZeligBuild" );
#else
protected static string BuildRoot = Expand( @"%DEPOTROOT%\ZeligBuild.Reference" );
#endif
#if DEBUG
#if DEBUG_INSTRUMENTATION
protected static string BuildFlavor = "Instrumentation";
#else
protected static string BuildFlavor = "Debug";
#endif
#else
protected static string BuildFlavor = "Release";
#endif
//
// State
//
protected List m_searchOrder;
protected string m_baseFile;
protected IR.CompilationSteps.DelegationCache m_delegationCache;
protected MetaDataResolver m_resolver;
protected TypeSystemForUnitTest m_typeSystem;
protected IR.CompilationSteps.Controller m_controller;
protected IMetaDataResolverHelper m_metaDataResolverHelper;
protected ISymbolResolverHelper m_symbolHelper;
private PerformanceCounters.Timing m_timing;
//
// Constructor Methods
//
protected BaseTester()
{
m_timing.Start();
}
//--//
protected string GetTime()
{
return string.Format( "{0,13:F6}", (float)PerformanceCounters.Timing.ToMicroSeconds( m_timing.Sample() ) / (1000 * 1000) );
}
protected void Initialize()
{
m_searchOrder = new List();
m_resolver = new Zelig.MetaData.MetaDataResolver( m_metaDataResolverHelper );
AddSearchDirectory( BuildRoot + @"\Target\bin\" + BuildFlavor );
AddSearchDirectory( BuildRoot + @"\Host\bin\" + BuildFlavor );
//
// We need this assembly, for all the extra stuff about open classes.
//
LoadAndResolve( BuildRoot + @"\Host\bin\" + BuildFlavor + @"\Microsoft.Zelig.Runtime.dll" );
}
protected void CreateTypeSystem()
{
m_typeSystem = new TypeSystemForUnitTest( this, this );
m_delegationCache = new IR.CompilationSteps.DelegationCache( m_typeSystem );
m_typeSystem.InitializeForCompilation();
//--//
var pa = new Microsoft.Zelig.Configuration.Environment.Abstractions.Architectures.ArmV4( m_typeSystem, null );
m_typeSystem.PlatformAbstraction = pa;
uint RamSize = 768 * 1024;
uint StartOfRam = 0x00000000;
uint EndOfRam = StartOfRam + RamSize;
#if USE_IMOTE_PLATFORM
uint SDRAMSize = 32 * 1024 * 1024;
uint StartOfSDRAM = 0xA0000000;
uint EndOfSDRAM = StartOfSDRAM + SDRAMSize;
uint StartOfFlash = 0x02000000;
uint FlashSize = 32 * 1024 * 1024;
#else
uint StartOfFlash = 0x90000000;
uint FlashSize = 8 * 1024 * 1024;
#endif
uint EndOfFlash = StartOfFlash + FlashSize;
uint FlashEntryPoint = StartOfFlash;
UIntPtr ptrRamStart = new UIntPtr( StartOfRam );
UIntPtr ptrRamEnd = new UIntPtr( EndOfRam );
#if USE_IMOTE_PLATFORM
UIntPtr ptrSDRAMStart = new UIntPtr( StartOfSDRAM );
UIntPtr ptrSDRAMEnd = new UIntPtr( EndOfSDRAM );
#endif
UIntPtr ptrFlashStart = new UIntPtr( StartOfFlash );
UIntPtr ptrFlashEnd = new UIntPtr( EndOfFlash );
UIntPtr ptrFlashEntryPoint = new UIntPtr( FlashEntryPoint );
RT.MemoryUsage codeDataRO = RT.MemoryUsage.Code | RT.MemoryUsage.DataRO | RT.MemoryUsage.Bootstrap;
RT.MemoryUsage anything = RT.MemoryUsage.Code | RT.MemoryUsage.DataRO | RT.MemoryUsage.DataRW | RT.MemoryUsage.VectorsTable;
pa.AddMemoryBlock( new RT.Memory.Range( ptrRamStart , ptrRamEnd , null, RT.MemoryAttributes.RAM , anything , null ) );
pa.AddMemoryBlock( new RT.Memory.Range( ptrFlashEntryPoint, ptrFlashEnd, null, RT.MemoryAttributes.FLASH | RT.MemoryAttributes.ConfiguredAtEntryPoint, codeDataRO | RT.MemoryUsage.Relocation, null ) );
#if USE_IMOTE_PLATFORM
pa.AddMemoryBlock( new RT.Memory.Range( ptrSDRAMStart , ptrSDRAMEnd, null, RT.MemoryAttributes.RAM , anything , null ) );
#endif
//--//
var cc = new Microsoft.Zelig.Configuration.Environment.Abstractions.ArmCallingConvention( m_typeSystem );
m_typeSystem.CallingConvention = cc;
}
protected void AddSearchDirectory( string dir )
{
dir = Expand( dir );
if(m_searchOrder.Contains( dir ) == false)
{
m_searchOrder.Add( dir );
}
}
protected void ConvertAllTypes()
{
foreach(Normalized.MetaDataAssembly asml in m_resolver.NormalizedAssemblies)
{
m_typeSystem.ImportAssembly( asml );
}
}
protected void ResolveAll()
{
m_typeSystem.ResolveAll();
}
protected void ExecuteSteps()
{
m_controller = new IR.CompilationSteps.Controller( m_typeSystem );
m_controller.ExecuteSteps();
}
protected void ConvertToIR()
{
Console.WriteLine( "{0}: ConvertToIR", GetTime() );
CreateTypeSystem();
ConvertAllTypes();
Console.WriteLine( "{0}: Done", GetTime() );
Console.WriteLine( "{0}: ResolveAll", GetTime() );
ResolveAll();
Console.WriteLine( "{0}: Done", GetTime() );
}
protected virtual void NotifyCompilationPhase( IR.CompilationSteps.PhaseDriver phase )
{
}
//--//
object TS.IEnvironmentProvider.GetService( Type t )
{
if(t == typeof(Normalized.IMetaDataBootstrap))
{
return m_resolver;
}
if(t == typeof(IR.CompilationSteps.DelegationCache))
{
return m_delegationCache;
}
return null;
}
//--//
protected static string Expand( string file )
{
return Environment.ExpandEnvironmentVariables( file );
}
protected void LoadAndResolve( string file )
{
if(m_baseFile == null)
{
m_baseFile = file;
m_searchOrder.Insert( 0, System.IO.Path.GetDirectoryName( file ) );
}
Importer.MetaData md = LoadAssembly( file );
m_resolver.Add( md );
m_resolver.ResolveAll();
}
private Importer.MetaData LoadAssembly( string file )
{
byte[] image = System.IO.File.ReadAllBytes( file );
Importer.PELoader pe = new Importer.PELoader( file, image );
Importer.MetaData md = Importer.MetaData.loadMetaData( file, m_symbolHelper, pe, Importer.MetaDataLoaderFlags.LoadCode | Importer.MetaDataLoaderFlags.LoadDebugInfo );
return md;
}
//--//
protected Importer.PdbInfo.PdbFile InnerResolveAssemblySymbols( string file )
{
try
{
file = System.IO.Path.GetDirectoryName( file ) + @"\" + System.IO.Path.GetFileNameWithoutExtension( file ) + ".pdb";
if(System.IO.File.Exists( file ))
{
byte[] image = System.IO.File.ReadAllBytes( file );
Importer.PdbInfo.PdbFile pdbFile = new Importer.PdbInfo.PdbFile( new Importer.ArrayReader( image ) );
return pdbFile;
}
}
catch
{
}
return null;
}
protected Importer.MetaData InnerResolveAssemblyReference( string name ,
MetaDataVersion ver )
{
Importer.MetaData md;
foreach(string dir in m_searchOrder)
{
md = CheckAndLoad( dir, name, ver );
if(md != null)
{
return md;
}
}
return null;
}
//--//
protected Importer.MetaData CheckAndLoad( string dir ,
string name )
{
string file = dir + @"\" + name + ".dll";
if(System.IO.File.Exists( file ))
{
try
{
return LoadAssembly( file );
}
catch
{
}
}
return null;
}
protected Importer.MetaData CheckAndLoad( string dir ,
string name ,
MetaDataVersion ver )
{
Importer.MetaData md = CheckAndLoad( dir, name );
if(md != null)
{
if(md.Assembly.Name == name && md.Assembly.Version.IsCompatible( ver, false ))
{
return md;
}
}
return null;
}
//--//--//
protected void SaveIrToDisk( string file ,
IR.TypeSystemForCodeTransformation typeSystem )
{
using(System.IO.FileStream stream = new System.IO.FileStream( file, FileMode.Create ))
{
IR.TypeSystemSerializer.Serialize( stream, typeSystem );
}
}
protected IR.TypeSystemForCodeTransformation LoadIrFromDisk( string file ,
IR.TypeSystemSerializer.CreateInstance callback )
{
using(System.IO.FileStream stream = new System.IO.FileStream( file, FileMode.Open ))
{
return IR.TypeSystemSerializer.Deserialize( stream, callback, null, 0 );
}
}
//--//
protected void DumpIRAsText( string file )
{
using(IR.TextIntermediateRepresentationDumper ird = new IR.TextIntermediateRepresentationDumper( file ))
{
foreach(TS.TypeRepresentation td in m_typeSystem.Types)
{
#if !DUMP_SINGLE_METHOD
ird.WriteLine( "###############################################################################" );
ird.WriteLine();
ird.WriteLine( "Type: {0} [Size={1}]", td, td.ValidLayout ? td.Size : uint.MaxValue );
if(td.Extends != null)
{
ird.WriteLine( " Extends: {0}", td.Extends );
}
foreach(TS.TypeRepresentation itf in td.Interfaces)
{
ird.WriteLine( " Interface: {0}", itf );
}
foreach(TS.FieldRepresentation fd in td.Fields)
{
ird.WriteLine( " Field: {0} [Offset={1}]", fd, fd.ValidLayout ? fd.Offset : -1 );
}
ird.WriteLine();
#endif
foreach(TS.MethodRepresentation md in td.Methods)
{
IR.ControlFlowGraphState cfg = IR.TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
#if DUMP_SINGLE_METHOD
//if(cfg.Method.ToString() != "")
{
continue;
}
#endif
ird.WriteLine( " Method {0}", md );
ird.WriteLine( );
cfg.Dump( ird );
}
#if !DUMP_SINGLE_METHOD
else
{
ird.WriteLine( " NoCodeMethod {0}", md );
}
ird.WriteLine();
#endif
}
}
}
}
protected void DumpIRAsText( string file ,
IEnumerable< TS.MethodRepresentation > enumerable )
{
using(IR.TextIntermediateRepresentationDumper ird = new IR.TextIntermediateRepresentationDumper( file ))
{
foreach(TS.MethodRepresentation md in ird.Sort( enumerable ))
{
IR.ControlFlowGraphState cfg = IR.TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
ird.WriteLine( "Method {0}", md );
ird.WriteLine( );
cfg.Dump( ird );
}
else
{
ird.WriteLine( "NoCodeMethod {0}", md );
}
ird.WriteLine();
}
}
}
protected void DumpIRAsXML( string file ,
IEnumerable< TS.MethodRepresentation > enumerable )
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNode node = XmlHelper.AddElement( doc, "Methods" );
IR.XmlIntermediateRepresentationDumper ird = new IR.XmlIntermediateRepresentationDumper( doc, node );
foreach(TS.MethodRepresentation md in ird.Sort( enumerable ))
{
IR.ControlFlowGraphState cfg = IR.TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
cfg.Dump( ird );
}
}
doc.Save( file );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/Bench.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Zelig.MetaData;
class Bench
{
public static void Main( string[] args )
{
if(args != null)
{
foreach(string arg in args)
{
switch(arg)
{
case "TypeSystemPopulationTester":
TypeSystemPopulationTester.Run( args );
break;
case "GenericInstantiationClosureTester":
GenericInstantiationClosureTester.Run( args );
break;
case "CodeGenerationTester":
CodeGenerationTester.Run( args );
break;
case "SerializationSpeedTester":
SerializationSpeedTester.Run( args );
break;
}
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/CodeGenerationTester.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define DEBUG_DUMP_ALL_PHASES_AFTER_TYPE_SYSTEM_REDUCTION
//#define DEBUG_DUMP_ALL_PHASES
#define DEBUG_DUMP_XML
//#define REPORT_OPERATORS_AT_EACH_PHASE
//#define CLONE_STATE
//#define USE_IMOTE_PLATFORM
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Zelig.MetaData;
using Importer = Microsoft.Zelig.MetaData.Importer;
using Normalized = Microsoft.Zelig.MetaData.Normalized;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
using ARM = Microsoft.Zelig.Emulation.ArmProcessor;
class CodeGenerationTester : BaseTester,
Microsoft.Zelig.MetaData.IMetaDataResolverHelper,
Microsoft.Zelig.MetaData.ISymbolResolverHelper
{
//
// State
//
private string m_filePrefix;
private bool m_fDumpIRToFile;
private int m_dumpCount;
//
// Constructor Methods
//
private CodeGenerationTester()
{
m_symbolHelper = this;
m_metaDataResolverHelper = this;
Initialize();
}
public static void Run( string[] args )
{
string[] files =
{
#if USE_IMOTE_PLATFORM
BuildRoot + @"\Target\bin\" + BuildFlavor + @"\Microsoft.iMote2.dll",
BuildRoot + @"\Target\bin\" + BuildFlavor + @"\Microsoft.DeviceModels.ModelForPXA27x.dll",
BuildRoot + @"\Target\bin\" + BuildFlavor + @"\QuickTest.exe",
#else
BuildRoot + @"\Target\bin\" + BuildFlavor + @"\mscorlib_unittest.exe",
BuildRoot + @"\Target\bin\" + BuildFlavor + @"\Microsoft.VoxSoloFormFactor.dll",
#endif
};
CodeGenerationTester pThis = new CodeGenerationTester();
pThis.Run( files, true, true );
Console.WriteLine( "Execution time: {0}", pThis.GetTime() );
}
private void Run( string[] files ,
bool fDumpIRToFile ,
bool fSerialize )
{
string root = Expand( @"%DEPOTROOT%\ZeligUnitTestResults\" );
string file2 = Path.GetFileNameWithoutExtension( files[0] );
string filePrefix = root + file2;
m_filePrefix = filePrefix;
m_fDumpIRToFile = fDumpIRToFile;
foreach(string file in files)
{
LoadAndResolve( file );
}
ConvertToIR();
#if CLONE_STATE
Console.WriteLine( "{0}: Cloning State", GetTime() );
byte[] buf;
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".serializer.txt" ))
{
buf = IR.TypeSystemSerializer.Serialize( m_typeSystem );
}
TypeSystemForUnitTest typeSystem2;
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".deserializer.txt" ))
{
typeSystem2 = (TypeSystemForUnitTest)IR.TypeSystemSerializer.Deserialize( new System.IO.MemoryStream( buf ), CreateInstanceForType );
}
TypeSystemForUnitTest typeSystem3 = m_typeSystem;
m_typeSystem = typeSystem2;
Console.WriteLine( "{0}: Done", GetTime() );
#endif
Console.WriteLine( "{0}: ExecuteSteps", GetTime() );
ExecuteSteps();
Console.WriteLine( "{0}: Done", GetTime() );
//--//
if(fSerialize)
{
Console.WriteLine( "{0}: Type System Serialization Test...", GetTime() );
System.IO.MemoryStream stream = new System.IO.MemoryStream();
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".serializer.txt" ))
{
IR.TypeSystemSerializer.Serialize( stream, m_typeSystem );
}
stream.Seek( 0, SeekOrigin.Begin );
TypeSystemForUnitTest deserializedTypeSystem;
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".deserializer.txt" ))
{
deserializedTypeSystem = (TypeSystemForUnitTest)IR.TypeSystemSerializer.Deserialize( stream, CreateInstanceForType, null, 0 );
}
System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".reserializer.txt" ))
{
IR.TypeSystemSerializer.Serialize( stream2, deserializedTypeSystem );
}
if(ArrayUtility.ArrayEquals( stream.ToArray(), stream2.ToArray() ))
{
Console.WriteLine( "{0}: Type System Serialization PASS", GetTime() );
}
else
{
Console.WriteLine( "{0}: Type System Serialization FAIL", GetTime() );
}
}
}
//--//
Importer.PdbInfo.PdbFile ISymbolResolverHelper.ResolveAssemblySymbols( string file )
{
return InnerResolveAssemblySymbols( file );
}
Importer.MetaData IMetaDataResolverHelper.ResolveAssemblyReference( string name ,
MetaDataVersion ver )
{
//
// Force use of our version of mscorlib.
//
if(name == "mscorlib" || name == "system")
{
return CheckAndLoad( BuildRoot + @"\Target\bin\" + BuildFlavor, name );
}
return InnerResolveAssemblyReference( name, ver );
}
//--//
private object CreateInstanceForType( Type t )
{
if(t == typeof(IR.TypeSystemForCodeTransformation))
{
return new TypeSystemForUnitTest( this, null );
}
return null;
}
private void DumpPerformanceCounters( string filePrefix )
{
if(PerformanceCounters.ContextualTiming.IsEnabled())
{
Console.WriteLine( "{0}: Dumping Performance Counters", GetTime() );
using(System.IO.StreamWriter output = new System.IO.StreamWriter( filePrefix + "_timing.type.txt", false, System.Text.Encoding.ASCII ))
{
PerformanceCounters.ContextualTiming.DumpAllByType( output );
}
using(System.IO.StreamWriter output = new System.IO.StreamWriter( filePrefix + "_timing.reason.txt", false, System.Text.Encoding.ASCII ))
{
PerformanceCounters.ContextualTiming.DumpAllByReason( output );
}
Console.WriteLine( "{0}: Done", GetTime() );
}
}
//--//
protected override void NotifyCompilationPhase( IR.CompilationSteps.PhaseDriver phase )
{
if(!m_fDumpIRToFile) return;
bool fDumpIR = false;
bool fDumpTXT = false;
#if DEBUG_DUMP_XML
bool fDumpXML = true;
#else
bool fDumpXML = false;
#endif
bool fDumpOps = false;
bool fDumpASM = false;
bool fDumpIMG = false;
++m_dumpCount;
Console.WriteLine( "{0}: Phase: {1}", GetTime(), phase );
#if REPORT_OPERATORS_AT_EACH_PHASE
fDumpOps = true;
#endif
//// if(phase >= IR.CompilationSteps.Phase.ConvertToSSA)
//// {
//// fDumpTXT = true;
//// }
if(phase is IR.CompilationSteps.Phases.GenerateImage)
{
DumpPerformanceCounters( m_filePrefix );
fDumpTXT = true;
}
else if(phase is IR.CompilationSteps.Phases.Done)
{
fDumpIMG = true;
fDumpASM = true;
fDumpTXT = true;
fDumpIR = true; m_typeSystem.DropCompileTimeObjects(); // Get the smallest dump.
}
//--//
#if DEBUG_DUMP_ALL_PHASES
fDumpTXT = true;
#endif
#if DEBUG_DUMP_ALL_PHASES_AFTER_TYPE_SYSTEM_REDUCTION
if(IR.CompilationSteps.PhaseDriver.CompareOrder( phase, typeof(IR.CompilationSteps.Phases.ReduceTypeSystem) ) > 0)
{
fDumpTXT = true;
}
#endif
//--//
//// if(phase is IR.CompilationSteps.Phases.LayoutTypes)
//// {
//// fDumpOps = true;
//// }
//// else if(phase is IR.CompilationSteps.Phases.GenerateImage ||
//// phase is IR.CompilationSteps.Phases.Done )
//// {
//// fDumpOps = true;
//// }
if(fDumpOps)
{
ReportOperators( phase );
}
if(fDumpIR || fDumpTXT || fDumpXML)
{
string file = string.Format( "{0}.{1:X2}.{2}.{3}.", m_filePrefix, m_dumpCount, phase.PhaseIndex, phase );
Console.WriteLine( "{0}: Dump {1}", GetTime(), file );
if(fDumpIR ) SaveIrToDisk( file + "ZeligImage", m_typeSystem );
if(fDumpTXT) DumpIRAsText( file + "ZeligIR" );
if(fDumpXML) DumpIRAsXML ( file + "xml" , GetAllMethods() );
if(fDumpASM)
{
m_typeSystem.DisassembleImage( file + "asmdir" );
}
if(fDumpIMG)
{
using(FileStream stream = new FileStream( file + "hex", FileMode.Create ))
{
foreach(var section in m_typeSystem.Image)
{
ARM.SRecordParser.Encode( stream, section.Payload, section.Address );
}
}
}
Console.WriteLine( "{0}: Done", GetTime() );
}
}
private void ReportOperators( IR.CompilationSteps.PhaseDriver phase )
{
GrowOnlySet< Type > types = SetFactory.NewWithReferenceEquality< Type >();
m_typeSystem.EnumerateFlowGraphs( delegate( IR.ControlFlowGraphStateForCodeTransformation cfg )
{
foreach(IR.Operator op in cfg.DataFlow_SpanningTree_Operators)
{
types.Insert( op.GetType() );
}
} );
Console.WriteLine( "Operators at phase {0}", phase );
foreach(Type t in types)
{
Console.WriteLine( " {0}", t.Name );
}
}
//--//
private List< TS.MethodRepresentation > GetAllMethods()
{
List< TS.MethodRepresentation > lst = new List< TS.MethodRepresentation >();
m_typeSystem.EnumerateMethods( delegate( TS.MethodRepresentation md )
{
lst.Add( md );
} );
return lst;
}
private List< TS.MethodRepresentation > GetAllReferencedMethods()
{
List< TS.MethodRepresentation > lst = new List< TS.MethodRepresentation >();
foreach(TS.MethodRepresentation md in m_controller.EntitiesReferencedByMethods.Keys)
{
lst.Add( md );
}
return lst;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/CodeGenerator.UnitTest.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{186F31A3-EF89-4A25-B2D5-20060606AA01}
Exe
Properties
Microsoft.Zelig.CodeGeneration.UnitTest
Microsoft.Zelig.CodeGeneration.UnitTest
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
v4.5
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
false
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
false
true
AllRules.ruleset
AnyCPU
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE;DEBUG;DEBUG_DUMP_ALL_PHASES;REPORT_OPERATORS_AT_EACH_PHASE;DEBUG_DUMP_XML;DEBUG_INSTRUMENTATION
true
AnyCPU
false
3.5
{186F31A3-EF89-4A25-B2D5-20060704AA01}
ArmProcessorEmulation
False
{186F31A3-EF89-4A25-B2D5-20070601AA01}
CommonPC
False
{186F31A3-EF89-4A25-B2D5-20060509AA01}
Kernel
False
{186F31A3-EF89-4A25-B2D5-20060404AA01}
Importer
False
{186F31A3-EF89-4A25-B2D5-20060510AA01}
Normalized
False
{186F31A3-EF89-4A25-B2D5-20061218AA01}
Common
False
{186F31A3-EF89-4A25-B2D5-20060720AA01}
TypeSystem
False
{186F31A3-EF89-4A25-B2D5-20070606AA01}
ProductConfiguration
False
{186F31A3-EF89-4A25-B2D5-20070222AA01}
CodeTransformation
False
{186F31A3-EF89-4A25-B2D5-20060603AA01}
IntermediateRepresentation
False
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/GenericInstantiationClosureTester.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Zelig.MetaData;
using Importer = Microsoft.Zelig.MetaData.Importer;
using Normalized = Microsoft.Zelig.MetaData.Normalized;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
class GenericInstantiationClosureTester : BaseTester,
Microsoft.Zelig.MetaData.IMetaDataResolverHelper
{
//
// Constructor Methods
//
private GenericInstantiationClosureTester()
{
m_metaDataResolverHelper = this;
Initialize();
//AddSearchDirectory( @"%WINDIR%\Microsoft.NET\Framework\v1.1.4322" );
//AddSearchDirectory( @"%WINDIR%\Microsoft.NET\Framework\v2.0.50727" );
}
public static void Run( string[] args )
{
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Pass\Pass.exe" , true );
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Fail_Field\Fail_Field.exe" , false );
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Fail_GenericMethod1\Fail_GenericMethod1.exe", false );
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Fail_GenericMethod2\Fail_GenericMethod2.exe", false );
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Fail_Inheritance\Fail_Inheritance.exe" , false );
Run( @"%DEPOTROOT%\Zelig\Test\GenericInstantiationClosure\Fail_Method\Fail_Method.exe" , false );
}
private static void Run( string file ,
bool fShouldPass )
{
Exception result = null;
try
{
GenericInstantiationClosureTester pThis;
pThis = new GenericInstantiationClosureTester();
pThis.LoadAndResolve( Expand( file ) );
pThis.ConvertToIR();
}
catch(Exception e)
{
result = e;
}
if((result == null) == fShouldPass)
{
Console.WriteLine( "Passed test for '{0}'", file );
}
else
{
Console.WriteLine( "Failed test for '{0}'", file );
Console.WriteLine( " {0}" , result );
}
}
//--//
Importer.MetaData IMetaDataResolverHelper.ResolveAssemblyReference( string name ,
MetaDataVersion ver )
{
return InnerResolveAssemblyReference( name, ver );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "Microsoft.Zelig.CodeGeneration.UnitTest" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Microsoft.Zelig.CodeGeneration.UnitTest" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2006" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
//// The following GUID is for the ID of the typelib if this project is exposed to COM
//[assembly: Guid( "012e8fb6-008e-45a0-ba5d-64b07a84aa95" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/SerializationSpeedTester.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using RT = Microsoft.Zelig.Runtime;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
class SerializationSpeedTester
{
private class TypeSystemForExecution : IR.TypeSystemForCodeTransformation
{
internal TypeSystemForExecution() : base( null )
{
}
}
public static void Run( string[] args )
{
//// string file = @"S:\enlistments\VOX\main\ZeligUnitTestResults\Microsoft.NohauLPC3180Loader.ZeligImage";
//// string file = @"S:\enlistments\VOX\main\ZeligUnitTestResults\mscorlib_UnitTest_FF.ZeligImage";
string file = @"S:\enlistments\VOX\main\ZeligUnitTestResults\soloTest_NXP.ZeligImage";
IR.TypeSystemForCodeTransformation ts;
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
using(System.IO.Stream serializedStream = new System.IO.FileStream( file, System.IO.FileMode.Open ))
{
IR.TypeSystemSerializer.CreateInstance dlgCreateInstance = delegate( Type t )
{
if(t == typeof(IR.TypeSystemForCodeTransformation))
{
return new TypeSystemForExecution();
}
return null;
};
IR.TypeSystemSerializer.ProgressCallback dlgProgress = delegate( long pos, long total )
{
};
ts = (IR.TypeSystemForCodeTransformation)IR.TypeSystemSerializer.Deserialize( serializedStream, dlgCreateInstance, dlgProgress, 10000 );
}
st.Stop();
long val1 = st.ElapsedMilliseconds;
st.Reset();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/TypeSystemPopulationTester.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.UnitTest
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.Zelig.MetaData;
using Importer = Microsoft.Zelig.MetaData.Importer;
using Normalized = Microsoft.Zelig.MetaData.Normalized;
using IR = Microsoft.Zelig.CodeGeneration.IR;
using TS = Microsoft.Zelig.Runtime.TypeSystem;
using ARM = Microsoft.Zelig.Emulation.ArmProcessor;
class TypeSystemPopulationTester : BaseTester,
Microsoft.Zelig.MetaData.IMetaDataResolverHelper,
Microsoft.Zelig.MetaData.ISymbolResolverHelper
{
//
// Constructor Methods
//
private TypeSystemPopulationTester()
{
m_symbolHelper = this;
m_metaDataResolverHelper = this;
Initialize();
//AddSearchDirectory( @"%WINDIR%\Microsoft.NET\Framework\v1.1.4322" );
//AddSearchDirectory( @"%WINDIR%\Microsoft.NET\Framework\v2.0.50727" );
}
public static void Run( string[] args )
{
DateTime start = DateTime.Now;
Run( BuildRoot + @"\Target\bin\" + BuildFlavor + @"\mscorlib_unittest.exe" , true );
//Run( BuildRoot + @"\Host\bin\" + BuildFlavor + @"\Microsoft.Zelig.MetaData.UnitTest.exe", false );
//Run( BuildRoot + @"\Host\bin\" + BuildFlavor + @"\Microsoft.Zelig.MetaData.UnitTest.exe", false );
DateTime stop = DateTime.Now;
Console.WriteLine( "Execution time: {0}", (stop - start) );
}
private static void Run( string file ,
bool fDumpTypeSystem )
{
TypeSystemPopulationTester pThis;
pThis = new TypeSystemPopulationTester();
pThis.LoadAndResolve( file );
pThis.ConvertToIR();
string root = Expand( @"%DEPOTROOT%\ZeligUnitTestResults\" );
string file2 = Path.GetFileNameWithoutExtension( file );
string filePrefix = root + file2;
if(fDumpTypeSystem)
{
using(System.IO.TextWriter writer = new System.IO.StreamWriter( filePrefix + ".TypeSystemDump.IrTxt", false, System.Text.Encoding.ASCII ))
{
foreach(TS.TypeRepresentation td in pThis.m_typeSystem.Types)
{
writer.WriteLine( "Type: {0}", td );
foreach(TS.TypeRepresentation itf in td.Interfaces)
{
writer.WriteLine( " Interface: {0}", itf );
}
foreach(TS.FieldRepresentation fd in td.Fields)
{
writer.WriteLine( " Field: {0}", fd );
}
foreach(TS.MethodRepresentation md in td.Methods)
{
writer.WriteLine( " Method: {0}", md );
}
writer.WriteLine();
}
}
}
//--//
System.IO.MemoryStream msSerialized = new System.IO.MemoryStream();
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".serializer.txt" ))
{
IR.TypeSystemSerializer.Serialize( msSerialized, pThis.m_typeSystem );
}
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.IO.Compression.GZipStream gzip = new System.IO.Compression.GZipStream( ms, System.IO.Compression.CompressionMode.Compress );
byte[] buf = msSerialized.ToArray();
gzip.Write( buf, 0, buf.Length );
gzip.Flush();
byte[] bufCompressed = ms.ToArray();
TypeSystemForUnitTest typeSystem2;
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".deserializer.txt" ))
{
typeSystem2 = (TypeSystemForUnitTest)IR.TypeSystemSerializer.Deserialize( new System.IO.MemoryStream( buf ), pThis.CreateInstanceForType, null, 0 );
}
System.IO.MemoryStream msSerialized2 = new System.IO.MemoryStream();
using(RedirectOutput ro = new RedirectOutput( filePrefix + ".reserializer.txt" ))
{
IR.TypeSystemSerializer.Serialize( msSerialized2, typeSystem2 );
}
byte[] buf2 = msSerialized2.ToArray();
if(ArrayUtility.ArrayEquals( buf, buf2 ))
{
Console.WriteLine( "{0}: Type System Serialization PASS" , DateTime.Now );
Console.WriteLine( "{0}: Serialized size = {1}, compressed size = {2}", DateTime.Now, buf.Length, bufCompressed.Length );
}
else
{
Console.WriteLine( "{0}: Type System Serialization FAIL", DateTime.Now );
}
}
private object CreateInstanceForType( Type t )
{
if(t == typeof(IR.TypeSystemForCodeTransformation))
{
return new TypeSystemForUnitTest( this, null );
}
return null;
}
//--//
Importer.PdbInfo.PdbFile ISymbolResolverHelper.ResolveAssemblySymbols( string file )
{
return InnerResolveAssemblySymbols( file );
}
Importer.MetaData IMetaDataResolverHelper.ResolveAssemblyReference( string name ,
MetaDataVersion ver )
{
return InnerResolveAssemblyReference( name, ver );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeGenerator.UnitTest/app.config
================================================
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/CallingConvention.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
public abstract class CallingConvention : ITransformationContextTarget
{
public enum Direction
{
Caller,
Callee,
}
public abstract class CallState : ITransformationContextTarget
{
//
// State
//
private Direction m_direction;
//
// Constructor Methods
//
protected CallState() // Default constructor required by TypeSystemSerializer.
{
}
protected CallState( Direction direction )
{
m_direction = direction;
}
//
// Helper Methods
//
public abstract RegisterDescriptor GetNextRegister( Platform platform ,
TypeRepresentation sourceTd ,
TypeRepresentation fragmentTd ,
ControlFlowGraphStateForCodeTransformation.KindOfFragment kind );
public abstract int GetNextIndex( Platform platform ,
TypeRepresentation sourceTd ,
TypeRepresentation fragmentTd ,
ControlFlowGraphStateForCodeTransformation.KindOfFragment kind );
public abstract bool CanMapToRegister( Platform platform ,
TypeRepresentation td );
public abstract bool CanMapResultToRegister( Platform platform ,
TypeRepresentation td );
public virtual void ApplyTransformation( TransformationContext context )
{
TransformationContextForCodeTransformation context2 = (TransformationContextForCodeTransformation)context;
context2.Push( this );
context2.Transform( ref m_direction );
context2.Pop();
}
//
// Access Methods
//
public Direction Direction
{
get
{
return m_direction;
}
}
}
//
// State
//
protected TypeSystemForCodeTransformation m_typeSystem;
//
// Constructor Methods
//
protected CallingConvention() // Default constructor required by TypeSystemSerializer.
{
}
protected CallingConvention( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
}
//
// Helper Methods
//
public virtual void ApplyTransformation( TransformationContext context )
{
TransformationContextForCodeTransformation context2 = (TransformationContextForCodeTransformation)context;
context2.Push( this );
context2.Transform( ref m_typeSystem );
context2.Pop();
}
//--//
public abstract void RegisterForNotifications( TypeSystemForCodeTransformation ts ,
CompilationSteps.DelegationCache cache );
public virtual void ExpandCallsClosure( CompilationSteps.ComputeCallsClosure computeCallsClosure )
{
}
//--//
public Expression[] AssignArgument( ControlFlowGraphStateForCodeTransformation cfg ,
Operator insertionOp ,
Expression ex ,
Abstractions.CallingConvention.CallState callState )
{
return AssignArgument( cfg, insertionOp, ex, ex.Type, callState );
}
public Expression[] AssignReturnValue( ControlFlowGraphStateForCodeTransformation cfg ,
Operator insertionOp ,
VariableExpression exReturnValue ,
Abstractions.CallingConvention.CallState callState )
{
if(exReturnValue != null)
{
return AssignReturnValue( cfg, insertionOp, exReturnValue, exReturnValue.Type, callState );
}
else
{
return null;
}
}
//--//
public abstract CallState CreateCallState( Direction direction );
public abstract Expression[] AssignArgument( ControlFlowGraphStateForCodeTransformation cfg ,
Operator insertionOp ,
Expression ex ,
TypeRepresentation td ,
Abstractions.CallingConvention.CallState callState );
public abstract Expression[] AssignReturnValue( ControlFlowGraphStateForCodeTransformation cfg ,
Operator insertionOp ,
VariableExpression exReturnValue ,
TypeRepresentation tdReturnValue ,
Abstractions.CallingConvention.CallState callState );
public abstract VariableExpression[] CollectExpressionsToInvalidate( ControlFlowGraphStateForCodeTransformation cfg ,
CallOperator op ,
Expression[] resFragments );
public abstract bool ShouldSaveRegister( RegisterDescriptor regDesc );
//--//
protected static VariableExpression[] MergeFragments( VariableExpression[] exDstArray ,
Expression[] exSrcArray )
{
if(exSrcArray != null)
{
foreach(Expression exSrc in exSrcArray)
{
VariableExpression var = exSrc as VariableExpression;
if(var != null)
{
exDstArray = AddUniqueToFragment( exDstArray, var );
}
}
}
return exDstArray;
}
protected static VariableExpression[] AddUniqueToFragment( VariableExpression[] array ,
VariableExpression var )
{
for(int i = array.Length; --i >= 0; )
{
if(array[i].IsTheSamePhysicalEntity( var ))
{
return array;
}
}
return ArrayUtility.AppendToNotNullArray( array, var );
}
protected static VariableExpression[] CollectAddressTakenExpressionsToInvalidate( ControlFlowGraphStateForCodeTransformation cfg ,
VariableExpression[] res ,
Operator context )
{
VariableExpression[] variables = cfg.DataFlow_SpanningTree_Variables;
VariableExpression.Property[] varProps = cfg.DataFlow_PropertiesOfVariables;
for(int varIdx = 0; varIdx < variables.Length; varIdx++)
{
if((varProps[varIdx] & VariableExpression.Property.AddressTaken) != 0)
{
VariableExpression var = variables[varIdx];
Expression[] fragments = cfg.GetFragmentsForExpression( var );
if(fragments != null)
{
res = MergeFragments( res, fragments );
}
else
{
res = AddUniqueToFragment( res, var );
}
}
}
return res;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/ExternalCallContext.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.CodeGeneration.IR.ExternalMethodImporters;
using Microsoft.Zelig.TargetModel.ArmProcessor;
public class ExternalCallContext
{
public static void Initialize(TypeSystemForCodeTransformation typeSystem)
{
if (typeSystem.PlatformAbstraction.CodeGenerator == InstructionSetVersion.CodeGenerator_Zelig)
{
ArmElfExternalCallContext.Initialize(typeSystem);
}
else
{
throw new ArgumentException("Unknown platform");
}
}
public static void Reset()
{
ArmElfExternalCallContext.Reset();
}
public static void ResetExternalCalls()
{
ArmElfExternalCallContext.ResetExternCalls();
}
public static ExternalCallOperator.IExternalCallContext[] Create( ImportedMethodReferenceAttribute.InteropFileType fileType, string filePath, string methodName, BasicBlock owner )
{
switch(fileType)
{
case ImportedMethodReferenceAttribute.InteropFileType.ArmELF:
return ArmElfExternalCallContext.Load( filePath, methodName, owner );
}
throw new NotImplementedException();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/PlacementRequirements.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
public class PlacementRequirements
{
//
// State
//
private bool m_fContentsUninitialized;
private bool m_fAllocateFromHighAddress;
private uint m_alignment;
private int m_alignmentOffset;
private string[] m_sections;
private Runtime.MemoryUsage[] m_usages;
private Runtime.MemoryAttributes[] m_memoryKinds;
//
// Constructor Methods
//
public PlacementRequirements( uint alignment ,
int alignmentOffset )
{
m_alignment = alignment;
m_alignmentOffset = alignmentOffset;
}
//
// Helper Methods
//
public void ApplyTransformation( TransformationContextForCodeTransformation context )
{
context.Push( this );
context.Transform( ref m_fContentsUninitialized );
context.Transform( ref m_fAllocateFromHighAddress );
context.Transform( ref m_alignment );
context.Transform( ref m_alignmentOffset );
context.Transform( ref m_sections );
context.Transform( ref m_usages );
context.Transform( ref m_memoryKinds );
context.Pop();
}
public PlacementRequirements Clone()
{
PlacementRequirements pr = new PlacementRequirements( m_alignment, m_alignmentOffset );
pr.m_sections = m_sections;
pr.m_usages = m_usages;
pr.m_memoryKinds = m_memoryKinds;
return pr;
}
public void AddConstraint( string section )
{
if(section != null)
{
m_sections = ArrayUtility.AddUniqueToArray( m_sections, section );
}
}
public void AddConstraint( Runtime.MemoryUsage usage )
{
m_usages = ArrayUtility.AppendToArray( m_usages, usage );
}
public void AddConstraint( Runtime.MemoryAttributes memoryKind )
{
m_memoryKinds = ArrayUtility.AppendToArray( m_memoryKinds, memoryKind );
}
//--//
public bool IsCompatible( PlacementRequirements pr )
{
if(pr != null)
{
if(Object.ReferenceEquals( this, pr ))
{
return true;
}
if( this.m_alignment == pr.m_alignment &&
this.m_alignmentOffset == pr.m_alignmentOffset &&
ArrayUtility.SameContents( this.m_sections , pr.m_sections ) &&
ArrayUtility.SameContents( this.m_usages , pr.m_usages ) &&
ArrayUtility.SameContents( this.m_memoryKinds , pr.m_memoryKinds ) )
{
return true;
}
}
return false;
}
public bool IsCompatible( string sectionName ,
Runtime.MemoryAttributes memoryKind ,
Runtime.MemoryUsage memoryUsage )
{
if(m_sections != null)
{
bool fGot = false;
foreach(string name in m_sections)
{
if(sectionName == name)
{
fGot = true;
break;
}
}
if(fGot == false)
{
return false;
}
}
if(m_usages != null)
{
bool fGot = false;
foreach(Runtime.MemoryUsage usage in m_usages)
{
if((memoryUsage & usage) == usage)
{
fGot = true;
break;
}
}
if(fGot == false)
{
return false;
}
}
if(m_memoryKinds != null)
{
bool fGot = false;
foreach(Runtime.MemoryAttributes kind in m_memoryKinds)
{
if((memoryKind & kind) == kind)
{
fGot = true;
break;
}
}
if(fGot == false)
{
return false;
}
}
return true;
}
//
// Access Methods
//
public uint Alignment
{
get
{
return m_alignment;
}
set
{
m_alignment = value;
}
}
public int AlignmentOffset
{
get
{
return m_alignmentOffset;
}
set
{
m_alignmentOffset = value;
}
}
public string[] Sections
{
get
{
return m_sections;
}
}
public Runtime.MemoryUsage[] Usages
{
get
{
return m_usages;
}
}
public Runtime.MemoryAttributes[] MemoryKinds
{
get
{
return m_memoryKinds;
}
}
public bool ContentsUninitialized
{
get
{
return m_fContentsUninitialized;
}
set
{
m_fContentsUninitialized = value;
}
}
public bool AllocateFromHighAddress
{
get
{
return m_fAllocateFromHighAddress;
}
set
{
m_fAllocateFromHighAddress = value;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/Platform.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
using Microsoft.Zelig.TargetModel.ArmProcessor;
public abstract class Platform : ITransformationContextTarget, Operator.IOperatorLevelHelper
{
//
// State
//
protected TypeSystemForCodeTransformation m_typeSystem;
//
// Constructor Methods
//
protected Platform() // Default constructor required by TypeSystemSerializer.
{
}
protected Platform( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
}
//
// Helper Methods
//
public virtual void ApplyTransformation( TransformationContext context )
{
TransformationContextForCodeTransformation context2 = (TransformationContextForCodeTransformation)context;
context2.Push( this );
context2.Transform( ref m_typeSystem );
context2.Pop();
}
//--//
public abstract void RegisterForNotifications( TypeSystemForCodeTransformation ts ,
CompilationSteps.DelegationCache cache );
public abstract TypeRepresentation GetRuntimeType( TypeSystemForCodeTransformation ts ,
Abstractions.RegisterDescriptor regDesc );
public virtual void ExpandCallsClosure( CompilationSteps.ComputeCallsClosure computeCallsClosure )
{
foreach(var regDesc in this.GetRegisters())
{
computeCallsClosure.Expand( GetRuntimeType( computeCallsClosure.TypeSystem, regDesc ) );
}
}
//--//
public abstract bool CanUseMultipleConditionCodes
{
get;
}
public abstract int EstimatedCostOfLoadOperation
{
get;
}
public abstract int EstimatedCostOfStoreOperation
{
get;
}
public abstract uint MemoryAlignment
{
get;
}
public abstract void GetListOfMemoryBlocks( List< Runtime.Memory.Range > list );
public abstract PlacementRequirements GetMemoryRequirements( object obj );
public abstract IR.ImageBuilders.CompilationState CreateCompilationState( IR.ImageBuilders.Core core ,
ControlFlowGraphStateForCodeTransformation cfg );
//--//
public abstract string CodeGenerator { get; }
public abstract uint PlatformFamily { get; }
public abstract uint PlatformVersion { get; }
public abstract uint PlatformVFP { get; }
public abstract bool PlatformBigEndian { get; }
public abstract InstructionSet GetInstructionSetProvider();
public abstract RegisterDescriptor[] GetRegisters();
public abstract RegisterDescriptor GetRegisterForEncoding( uint regNum );
public abstract RegisterDescriptor GetScratchRegister();
public abstract void ComputeNumberOfFragmentsForExpression( TypeRepresentation sourceTd ,
ControlFlowGraphStateForCodeTransformation.KindOfFragment kind ,
out uint sourceFragments ,
out bool fDirect );
public abstract bool CanFitInRegister( TypeRepresentation td );
//--//
public abstract TypeRepresentation GetMethodWrapperType();
public abstract bool HasRegisterContextArgument( MethodRepresentation md );
public abstract void ComputeSetOfRegistersToSave( Abstractions.CallingConvention cc ,
ControlFlowGraphStateForCodeTransformation cfg ,
BitVector modifiedRegisters ,
out BitVector registersToSave ,
out Runtime.HardwareException he );
//--//
bool Operator.IOperatorLevelHelper.FitsInPhysicalRegister( TypeRepresentation td )
{
return CanFitTypeInPhysicalRegister( td );
}
protected abstract bool CanFitTypeInPhysicalRegister( TypeRepresentation td );
//--//
public abstract bool CanPropagateCopy( SingleAssignmentOperator opSrc ,
Operator opDst ,
int exIndexInDst ,
VariableExpression[] variables ,
BitVector[] variableUses ,
BitVector[] variableDefinitions ,
Operator[] operators );
//--//
public static void SetConstraintOnResultsBasedOnType( CompilationSteps.PhaseExecution.NotificationContext nc ,
VariableExpression[] results )
{
for(int i = 0; i < results.Length; i++)
{
SetConstraintOnLhsBasedOnType( nc, results, i );
}
}
public static void SetConstraintOnLhsBasedOnType( CompilationSteps.PhaseExecution.NotificationContext nc ,
VariableExpression[] lhs ,
int varIndex )
{
SetConstraintBasedOnType( nc, lhs[varIndex], varIndex, true );
}
public static void SetConstraintOnArgumentsBasedOnType( CompilationSteps.PhaseExecution.NotificationContext nc ,
Expression[] arguments )
{
for(int i = 0; i < arguments.Length; i++)
{
SetConstraintOnRhsBasedOnType( nc, arguments, i );
}
}
public static void SetConstraintOnRhsBasedOnType( CompilationSteps.PhaseExecution.NotificationContext nc ,
Expression[] rhs ,
int varIndex )
{
SetConstraintBasedOnType( nc, rhs[varIndex], varIndex, false );
}
public static void SetConstraintBasedOnType( CompilationSteps.PhaseExecution.NotificationContext nc ,
Expression ex ,
int varIndex ,
bool fIsResult )
{
if(ex != null)
{
TypeRepresentation td = ex.Type;
if(td.IsFloatingPoint)
{
if(td.SizeOfHoldingVariableInWords == 1)
{
SetConstraint( nc, varIndex, fIsResult, RegisterClass.SinglePrecision );
}
else
{
SetConstraint( nc, varIndex, fIsResult, RegisterClass.DoublePrecision );
}
}
else if(td is PointerTypeRepresentation)
{
SetConstraint( nc, varIndex, fIsResult, RegisterClass.Address );
}
else
{
SetConstraint( nc, varIndex, fIsResult, RegisterClass.Integer );
}
}
}
public static void SetConstraintOnLHS( CompilationSteps.PhaseExecution.NotificationContext nc ,
int varIndex ,
RegisterClass constraint )
{
SetConstraint( nc, varIndex, true, constraint );
}
public static void SetConstraintOnRHS( CompilationSteps.PhaseExecution.NotificationContext nc ,
int varIndex ,
RegisterClass constraint )
{
SetConstraint( nc, varIndex, false, constraint );
}
public static void SetConstraint( CompilationSteps.PhaseExecution.NotificationContext nc ,
int varIndex ,
bool fIsResult ,
RegisterClass constraint )
{
nc.CurrentOperator.AddAnnotation( RegisterAllocationConstraintAnnotation.Create( nc.TypeSystem, varIndex, fIsResult, constraint ) );
}
//--//
public static bool MoveToPseudoRegisterIfConstant( ControlFlowGraphStateForCodeTransformation cfg ,
Operator op ,
Expression ex )
{
if(ex is ConstantExpression)
{
MoveToPseudoRegister( cfg, op, ex );
return true;
}
return false;
}
public static VariableExpression MoveToPseudoRegister( ControlFlowGraphStateForCodeTransformation cfg ,
Operator op ,
Expression ex )
{
VariableExpression exReg = cfg.AllocatePseudoRegister( ex.Type );
op.AddOperatorBefore( SingleAssignmentOperator.New( op.DebugInfo, exReg, ex ) );
op.SubstituteUsage( ex, exReg );
return exReg;
}
public static PseudoRegisterExpression AllocatePseudoRegisterIfNeeded( ControlFlowGraphStateForCodeTransformation cfg ,
Expression ex )
{
var var = ex as VariableExpression;
if(var != null)
{
var exStack = var.AliasedVariable as StackLocationExpression;
if(exStack != null)
{
return cfg.AllocatePseudoRegister( exStack.Type, exStack.DebugName );
}
}
return null;
}
public static PseudoRegisterExpression AllocatePseudoRegisterIfNeeded( ControlFlowGraphStateForCodeTransformation cfg ,
Expression ex ,
bool fConstantOk )
{
var res = AllocatePseudoRegisterIfNeeded( cfg, ex );
if(res == null)
{
if(fConstantOk == false && ex is ConstantExpression)
{
res = cfg.AllocatePseudoRegister( ex.Type );
}
}
return res;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/RegisterClass.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
[Flags]
public enum RegisterClass : uint
{
None = 0x00000000,
Address = 0x00000001,
System = 0x00000002,
Integer = 0x00000004,
SinglePrecision = 0x00000008,
DoublePrecision = 0x00000010,
DoublePrecision_Low = 0x00000020,
DoublePrecision_High = 0x00000040,
StatusRegister = 0x04000000,
LinkAddress = 0x08000000,
StackPointer = 0x10000000,
ProgramCounter = 0x20000000,
AvailableForAllocation = 0x40000000,
Special = 0x80000000,
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Abstractions/RegisterDescriptor.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.Abstractions
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
public class RegisterDescriptor
{
public static readonly RegisterDescriptor[] SharedEmptyArray = new RegisterDescriptor[0];
public enum Pair
{
Int_Int = 0,
Int_FP = 1,
Int_Sys = 2,
FP_Int = 3,
FP_FP = 4,
FP_Sys = 5,
Sys_Int = 6,
Sys_FP = 7,
Sys_Sys = 8,
}
//
// State
//
int m_index;
string m_mnemonic;
uint m_encoding;
uint m_physicalStorageOffset;
uint m_physicalStorageSize;
RegisterDescriptor[] m_interfersWith;
RegisterClass m_physicalClass;
RegisterClass m_storageCapabilities;
RegisterClass m_computeCapabilities;
//
// Constructor Methods
//
private RegisterDescriptor( List< RegisterDescriptor > lst ,
string mnemonic ,
uint encoding ,
uint physicalStorageOffset ,
uint physicalStorageSize )
{
m_index = lst.Count;
m_mnemonic = mnemonic;
m_physicalStorageOffset = physicalStorageOffset;
m_physicalStorageSize = physicalStorageSize;
m_encoding = encoding;
m_interfersWith = SharedEmptyArray;
lst.Add( this );
}
//
// Helper Methods
//
public void ApplyTransformation( TransformationContextForCodeTransformation context )
{
context.Push( this );
context.Transform( ref m_index );
context.Transform( ref m_mnemonic );
context.Transform( ref m_encoding );
context.Transform( ref m_physicalStorageOffset );
context.Transform( ref m_physicalStorageSize );
context.Transform( ref m_interfersWith );
context.Transform( ref m_physicalClass );
context.Transform( ref m_storageCapabilities );
context.Transform( ref m_computeCapabilities );
context.Pop();
}
//--//
public static RegisterDescriptor ExtractFromExpression( Expression ex )
{
var var = ex as VariableExpression;
if(var != null)
{
var reg = var.AliasedVariable as PhysicalRegisterExpression;
if(reg != null)
{
return reg.RegisterDescriptor;
}
}
return null;
}
public static Pair GetPairState( RegisterDescriptor lhs ,
RegisterDescriptor rhs )
{
if(lhs.InIntegerRegisterFile)
{
if(rhs.InIntegerRegisterFile)
{
return Pair.Int_Int;
}
if(rhs.IsSystemRegister)
{
return Pair.Int_Sys;
}
return Pair.Int_FP;
}
else if(lhs.InFloatingPointRegisterFile)
{
if(rhs.InIntegerRegisterFile)
{
return Pair.FP_Int;
}
if(rhs.IsSystemRegister)
{
return Pair.FP_Sys;
}
return Pair.FP_FP;
}
else
{
if(rhs.InIntegerRegisterFile)
{
return Pair.Sys_Int;
}
if(rhs.IsSystemRegister)
{
return Pair.Sys_Sys;
}
return Pair.Sys_FP;
}
}
public static RegisterDescriptor CreateTemplateFor32bitSystemRegister( List< RegisterDescriptor > lst ,
string mnemonic ,
uint encoding ,
uint physicalStorageOffset ,
Abstractions.RegisterClass physicalClass )
{
RegisterDescriptor reg = new RegisterDescriptor( lst, mnemonic, encoding, physicalStorageOffset, 1 );
physicalClass |= RegisterClass.System;
reg.m_physicalClass = physicalClass;
reg.m_storageCapabilities = RegisterClass.None;
reg.m_computeCapabilities = RegisterClass.None;
return reg;
}
public static RegisterDescriptor CreateTemplateFor32bitIntegerRegister( List< RegisterDescriptor > lst ,
string mnemonic ,
uint encoding ,
uint physicalStorageOffset ,
Abstractions.RegisterClass physicalClass )
{
RegisterDescriptor reg = new RegisterDescriptor( lst, mnemonic, encoding, physicalStorageOffset, 1 );
physicalClass |= RegisterClass.Integer;
reg.m_physicalClass = physicalClass;
reg.m_storageCapabilities = RegisterClass.Integer |
RegisterClass.Address |
RegisterClass.SinglePrecision |
RegisterClass.DoublePrecision_Low |
RegisterClass.DoublePrecision_High ;
reg.m_computeCapabilities = RegisterClass.Integer |
RegisterClass.Address ;
return reg;
}
public static RegisterDescriptor CreateTemplateFor32bitFloatingPointRegister( List< RegisterDescriptor > lst ,
string mnemonic ,
uint encoding ,
uint physicalStorageOffset ,
Abstractions.RegisterClass physicalClass ,
bool lowPart )
{
RegisterDescriptor reg = new RegisterDescriptor( lst, mnemonic, encoding, physicalStorageOffset, 1 );
physicalClass |= RegisterClass.SinglePrecision;
reg.m_physicalClass = physicalClass;
reg.m_storageCapabilities = RegisterClass.Integer |
RegisterClass.SinglePrecision | (lowPart ? RegisterClass.DoublePrecision_Low : RegisterClass.DoublePrecision_High);
reg.m_computeCapabilities = RegisterClass.SinglePrecision;
return reg;
}
public static RegisterDescriptor CreateTemplateFor64bitFloatingPointRegister( List< RegisterDescriptor > lst ,
string mnemonic ,
uint encoding ,
uint physicalStorageOffset ,
Abstractions.RegisterClass physicalClass )
{
RegisterDescriptor reg = new RegisterDescriptor( lst, mnemonic, encoding, physicalStorageOffset, 2 );
physicalClass |= RegisterClass.DoublePrecision;
reg.m_physicalClass = physicalClass;
reg.m_storageCapabilities = RegisterClass.DoublePrecision;
reg.m_computeCapabilities = RegisterClass.DoublePrecision;
return reg;
}
public void AddInterference( RegisterDescriptor reg )
{
m_interfersWith = ArrayUtility.AddUniqueToNotNullArray( m_interfersWith, reg );
}
public object ValueFromBytes( uint[] data )
{
if(this.InIntegerRegisterFile)
{
switch(m_physicalStorageSize)
{
case 1:
return data[0];
case 2:
return ((ulong)data[1] << 32) | (ulong)data[0];
default:
return null;
}
}
else if(this.InFloatingPointRegisterFile)
{
if(this.IsDoublePrecision)
{
return DataConversion.GetDoubleFromBytes( ((ulong)data[1] << 32) | (ulong)data[0] );
}
else
{
return DataConversion.GetFloatFromBytes( data[0] );
}
}
else
{
return data[0];
}
}
public uint[] BytesFromValue( object value )
{
uint[] res = new uint[m_physicalStorageSize];
if(this.InIntegerRegisterFile)
{
switch(m_physicalStorageSize)
{
case 1:
res[0] = (uint)value;
break;
case 2:
ulong val = (ulong)value;
res[0] = (uint) val ;
res[1] = (uint)(val >> 32);
break;
default:
return null;
}
}
else if(this.InFloatingPointRegisterFile)
{
if(this.IsDoublePrecision)
{
ulong val = DataConversion.GetDoubleAsBytes( (double)value );
res[0] = (uint) val ;
res[1] = (uint)(val >> 32);
}
else
{
uint val = DataConversion.GetFloatAsBytes( (float)value );
res[0] = val;
}
}
else
{
res[0] = (uint)value;
}
return res;
}
//
// Access Methods
//
public int Index
{
get
{
return m_index;
}
}
public string Mnemonic
{
get
{
return m_mnemonic;
}
}
public RegisterClass PhysicalClass
{
get
{
return m_physicalClass;
}
}
public uint Encoding
{
get
{
return m_encoding;
}
}
public uint PhysicalStorageOffset
{
get
{
return m_physicalStorageOffset;
}
}
public uint PhysicalStorageSize
{
get
{
return m_physicalStorageSize;
}
}
public RegisterDescriptor[] InterfersWith
{
get
{
return m_interfersWith;
}
}
public RegisterClass StorageCapabilities
{
get
{
return m_storageCapabilities;
}
}
public RegisterClass ComputeCapabilities
{
get
{
return m_computeCapabilities;
}
}
public bool InIntegerRegisterFile
{
get
{
return (this.PhysicalClass & RegisterClass.Integer) != 0;
}
}
public bool InFloatingPointRegisterFile
{
get
{
return (this.PhysicalClass & (RegisterClass.SinglePrecision | RegisterClass.DoublePrecision)) != 0;
}
}
public bool IsDoublePrecision
{
get
{
return (this.PhysicalClass & RegisterClass.DoublePrecision) != 0;
}
}
public bool IsSystemRegister
{
get
{
return (this.PhysicalClass & RegisterClass.System) != 0;
}
}
public bool IsSpecial
{
get
{
return (this.PhysicalClass & RegisterClass.Special) != 0;
}
}
public bool IsLinkAddress
{
get
{
return (this.PhysicalClass & RegisterClass.LinkAddress) != 0;
}
}
public bool CanAllocate
{
get
{
return (this.PhysicalClass & RegisterClass.AvailableForAllocation) != 0;
}
}
//
// Debug Methods
//
public override String ToString()
{
return string.Format( "RegisterDescriptor( {0} )", this.Mnemonic );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Annotations/InliningPathAnnotation.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using Debugging;
using Microsoft.Zelig.Runtime.TypeSystem;
using System;
using System.Diagnostics;
public sealed class InliningPathAnnotation
: Annotation
, IInliningPathAnnotation
{
//
// State
//
// this is the original path used in the inlining heuristics unmodified for compatibility
private MethodRepresentation[] m_path;
// This contains the locations where the operator that this annotation is attached to was inlined into
private DebugInfo[] m_InlinedAt;
//
// Constructor Methods
//
private InliningPathAnnotation( MethodRepresentation[] path, DebugInfo[] inlinedAt )
{
Debug.Assert(path.Length == inlinedAt.Length);
Debug.Assert(path.Length != 0);
m_path = path;
m_InlinedAt = inlinedAt;
}
public static InliningPathAnnotation Create( TypeSystemForIR ts ,
InliningPathAnnotation anOuter ,
MethodRepresentation md ,
DebugInfo debugInfo,
InliningPathAnnotation anInner )
{
Debug.Assert(anOuter == null || anOuter.DebugInfoPath.Length == anOuter.Path.Length);
Debug.Assert(anInner == null || anInner.DebugInfoPath.Length == anInner.Path.Length);
var pathOuter = anOuter != null ? anOuter.m_path : MethodRepresentation.SharedEmptyArray;
var pathInner = anInner != null ? anInner.Path : MethodRepresentation.SharedEmptyArray;
var path = ArrayUtility.AppendToNotNullArray( pathOuter, md );
path = ArrayUtility.AppendNotNullArrayToNotNullArray( path, pathInner );
// if the operator or varialbe didn't have debug info, then use the method itself
if (debugInfo == null)
debugInfo = md.DebugInfo;
var debugInfoOuter = anOuter?.m_InlinedAt ?? DebugInfo.SharedEmptyArray;
var debugInfoInner = anInner?.m_InlinedAt ?? DebugInfo.SharedEmptyArray;
var debugInfoPath = ArrayUtility.AppendToNotNullArray( debugInfoOuter, debugInfo );
debugInfoPath = ArrayUtility.AppendNotNullArrayToNotNullArray( debugInfoPath, debugInfoInner );
return (InliningPathAnnotation)MakeUnique( ts, new InliningPathAnnotation( path, debugInfoPath ) );
}
//
// Equality Methods
//
public override bool Equals( Object obj )
{
if(obj is InliningPathAnnotation)
{
InliningPathAnnotation other = (InliningPathAnnotation)obj;
return ArrayUtility.ArrayEqualsNotNull( this.m_path, other.m_path, 0 );
}
return false;
}
public override int GetHashCode()
{
if(m_path.Length > 0)
{
return m_path[0].GetHashCode();
}
return 0;
}
//
// Helper Methods
//
public override Annotation Clone( CloningContext context )
{
MethodRepresentation[] path = context.ConvertMethods( m_path );
if(Object.ReferenceEquals( path, m_path ))
{
return this; // Nothing to change.
}
return RegisterAndCloneState( context, MakeUnique( context.TypeSystem, new InliningPathAnnotation( path, m_InlinedAt ) ) );
}
//--//
public override void ApplyTransformation( TransformationContextForIR context )
{
context.Push( this );
base.ApplyTransformation( context );
object origin = context.GetTransformInitiator();
if(origin is CompilationSteps.ComputeCallsClosure.Context)
{
//
// Don't propagate the path, it might include methods that don't exist anymore.
//
}
else if (context is TypeSystemForCodeTransformation.FlagProhibitedUses)
{
TypeSystemForCodeTransformation ts = (TypeSystemForCodeTransformation)context.GetTypeSystem();
for (int i = m_path.Length; --i >= 0;)
{
MethodRepresentation md = m_path[i];
if (ts.ReachabilitySet.IsProhibited(md))
{
m_path = ArrayUtility.RemoveAtPositionFromNotNullArray(m_path, i);
// REVIEW:
// Consider implications of not removing the entry, but instead
// setting the scope to null, this would keep the Source and line debug
// info so the debug info code gneration could treat this like a
// pre-processor macro substitution instead of an inlined call to
// a function that doesn't exist anymore.
m_InlinedAt = ArrayUtility.RemoveAtPositionFromNotNullArray(m_InlinedAt, i);
IsSquashed = true;
}
}
}
else
{
context.Transform( ref m_path );
// TODO: Handle m_DebugInfo - there is no Transform method for DebugInfo[] so this info isn't serialized, etc...
}
context.Pop();
//Debug.Assert(m_path.Length == m_InlinedAt.Length);
//Debug.Assert(m_path.Length != 0 || IsSquashed);
}
//--//
//
// Access Methods
//
public bool IsSquashed { get; private set; }
/// Method path for an inlined operator
///
/// The last entry in the array contains the original source method for the operator this annotation is attached to.
///
public MethodRepresentation[] Path => m_path;
/// Retrieves the source location information for the inlining chain
///
/// It is possible for entries in this array to be null if there was no debug information
/// for the call site the method is inlined into.
/// It is worth noting that the debug info path does not "line up" with the
/// array, it is in fact off by one index. This is due to the fact that the operator that this
/// annotation applies to has its own DebugInfo indicating its source location. Thus, the last
/// entry in DebugInfoPath contains the source location where the operator was inlined *into*.
///
public Debugging.DebugInfo[] DebugInfoPath => m_InlinedAt;
//--//
//
// Debug Methods
//
public override string FormatOutput( IIntermediateRepresentationDumper dumper )
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append( "" );
sb.Append("");
return sb.ToString();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Annotations/RegisterAllocationConstraintAnnotation.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class RegisterAllocationConstraintAnnotation : Annotation
{
//
// State
//
private int m_varIndex;
private bool m_fIsResult;
private Abstractions.RegisterClass m_constraint;
//
// Constructor Methods
//
private RegisterAllocationConstraintAnnotation( int index ,
bool fIsResult ,
Abstractions.RegisterClass constraint )
{
m_varIndex = index;
m_fIsResult = fIsResult;
m_constraint = constraint;
}
public static RegisterAllocationConstraintAnnotation Create( TypeSystemForIR ts ,
int index ,
bool fIsResult ,
Abstractions.RegisterClass constraint )
{
return (RegisterAllocationConstraintAnnotation)MakeUnique( ts, new RegisterAllocationConstraintAnnotation( index, fIsResult, constraint ) );
}
//
// Equality Methods
//
public override bool Equals( Object obj )
{
if(obj is RegisterAllocationConstraintAnnotation)
{
RegisterAllocationConstraintAnnotation other = (RegisterAllocationConstraintAnnotation)obj;
if(m_varIndex == other.m_varIndex &&
m_fIsResult == other.m_fIsResult &&
m_constraint == other.m_constraint )
{
return true;
}
}
return false;
}
public override int GetHashCode()
{
return 0x0F88DAC4 ^ m_varIndex;
}
//
// Helper Methods
//
public override Annotation Clone( CloningContext context )
{
return this; // Nothing to change.
}
//--//
public override void ApplyTransformation( TransformationContextForIR context )
{
var context2 = (TransformationContextForCodeTransformation)context;
context2.Push( this );
base.ApplyTransformation( context2 );
context2.Transform( ref m_varIndex );
context2.Transform( ref m_fIsResult );
context2.Transform( ref m_constraint );
context2.Pop();
}
//--//
public static bool ShouldLhsBeMovedToPseudoRegister( Operator op ,
int index )
{
if(VariableExpression.ExtractAliased( op.Results[index] ) is StackLocationExpression)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == true && an.VarIndex == index)
{
if((an.Constraint & ~Abstractions.RegisterClass.Address) != Abstractions.RegisterClass.None)
{
return true;
}
}
}
}
return false;
}
public static bool ShouldRhsBeMovedToPseudoRegister( Operator op ,
int index )
{
if(VariableExpression.ExtractAliased( op.Arguments[index] ) is StackLocationExpression)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == false && an.VarIndex == index)
{
if((an.Constraint & ~Abstractions.RegisterClass.Address) != Abstractions.RegisterClass.None)
{
return true;
}
}
}
}
return false;
}
//--//
public static Abstractions.RegisterClass ComputeConstraintsForLHS( Operator op ,
VariableExpression ex )
{
Abstractions.RegisterClass constraint = Abstractions.RegisterClass.None;
if(op != null)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == true && op.Results[an.VarIndex] == ex)
{
constraint |= an.Constraint;
}
}
}
return constraint;
}
public static Abstractions.RegisterClass ComputeConstraintsForRHS( Operator op ,
Expression ex )
{
Abstractions.RegisterClass constraint = Abstractions.RegisterClass.None;
if(op != null)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == false && op.Arguments[an.VarIndex] == ex)
{
constraint |= an.Constraint;
}
}
}
return constraint;
}
public static Abstractions.RegisterClass ComputeConstraintsForLHS( Operator op ,
int lhsIndex )
{
Abstractions.RegisterClass constraint = Abstractions.RegisterClass.None;
if(op != null)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == true && an.VarIndex == lhsIndex)
{
constraint |= an.Constraint;
}
}
}
return constraint;
}
public static Abstractions.RegisterClass ComputeConstraintsForRHS( Operator op ,
int rhsIndex )
{
Abstractions.RegisterClass constraint = Abstractions.RegisterClass.None;
if(op != null)
{
foreach(var an in op.FilterAnnotations< RegisterAllocationConstraintAnnotation >())
{
if(an.IsResult == false && an.VarIndex == rhsIndex)
{
constraint |= an.Constraint;
}
}
}
return constraint;
}
//--//
//
// Access Methods
//
public int VarIndex
{
get
{
return m_varIndex;
}
}
public bool IsResult
{
get
{
return m_fIsResult;
}
}
public Abstractions.RegisterClass Constraint
{
get
{
return m_constraint;
}
}
//--//
//
// Debug Methods
//
public override string FormatOutput( IIntermediateRepresentationDumper dumper )
{
return dumper.FormatOutput( "", m_fIsResult ? "LHS" : "RHS", m_varIndex , m_constraint );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/Annotations/RegisterCouplingConstraintAnnotation.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class RegisterCouplingConstraintAnnotation : Annotation
{
//
// State
//
private int m_varIndex1;
private bool m_fIsResult1;
private int m_varIndex2;
private bool m_fIsResult2;
//
// Constructor Methods
//
private RegisterCouplingConstraintAnnotation( int index1 ,
bool fIsResult1 ,
int index2 ,
bool fIsResult2 )
{
m_varIndex1 = index1;
m_fIsResult1 = fIsResult1;
m_varIndex2 = index2;
m_fIsResult2 = fIsResult2;
}
public static RegisterCouplingConstraintAnnotation Create( TypeSystemForIR ts ,
int index1 ,
bool fIsResult1 ,
int index2 ,
bool fIsResult2 )
{
return (RegisterCouplingConstraintAnnotation)MakeUnique( ts, new RegisterCouplingConstraintAnnotation( index1, fIsResult1, index2, fIsResult2 ) );
}
//
// Equality Methods
//
public override bool Equals( Object obj )
{
if(obj is RegisterCouplingConstraintAnnotation)
{
var other = (RegisterCouplingConstraintAnnotation)obj;
if(m_varIndex1 == other.m_varIndex1 &&
m_fIsResult1 == other.m_fIsResult1 &&
m_varIndex2 == other.m_varIndex2 &&
m_fIsResult2 == other.m_fIsResult2 )
{
return true;
}
}
return false;
}
public override int GetHashCode()
{
return 0x0E47C2CA ^ m_varIndex1 ^ (m_varIndex2 << 10);
}
//
// Helper Methods
//
public override Annotation Clone( CloningContext context )
{
return this; // Nothing to change.
}
//--//
public override void ApplyTransformation( TransformationContextForIR context )
{
var context2 = (TransformationContextForCodeTransformation)context;
context2.Push( this );
base.ApplyTransformation( context2 );
context2.Transform( ref m_varIndex1 );
context2.Transform( ref m_fIsResult1 );
context2.Transform( ref m_varIndex2 );
context2.Transform( ref m_fIsResult2 );
context2.Pop();
}
//--//
public void ExtractTargets( Operator op ,
out VariableExpression var1 ,
out VariableExpression var2 )
{
var1 = m_fIsResult1 ? op.Results[m_varIndex1] : (op.Arguments[m_varIndex1] as VariableExpression);
var2 = m_fIsResult2 ? op.Results[m_varIndex2] : (op.Arguments[m_varIndex2] as VariableExpression);
}
public VariableExpression FindCoupledExpression( Operator op ,
VariableExpression ex )
{
VariableExpression var1;
VariableExpression var2;
ExtractTargets( op, out var1, out var2 );
if(var1 == ex) return var2;
if(var2 == ex) return var1;
return null;
}
//--//
//
// Access Methods
//
public int VarIndex1
{
get
{
return m_varIndex1;
}
}
public bool IsResult1
{
get
{
return m_fIsResult1;
}
}
public int VarIndex2
{
get
{
return m_varIndex2;
}
}
public bool IsResult2
{
get
{
return m_fIsResult2;
}
}
//--//
//
// Debug Methods
//
public override string FormatOutput( IIntermediateRepresentationDumper dumper )
{
return dumper.FormatOutput( " {2}({3})>", m_fIsResult1 ? "LHS" : "RHS", m_varIndex1, m_fIsResult2 ? "LHS" : "RHS", m_varIndex2 );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/BitFieldDefinition.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.Zelig.MetaData;
using Microsoft.Zelig.MetaData.Normalized;
using Microsoft.Zelig.Runtime.TypeSystem;
[AllowCompileTimeIntrospection]
public sealed class BitFieldDefinition
{
[AllowCompileTimeIntrospection]
public sealed class Section
{
//
// State
//
public uint Position;
public uint Size;
public uint Offset;
public Runtime.BitFieldModifier Modifiers;
public uint ReadsAs;
public uint WritesAs;
}
//
// State
//
public static readonly Section[] SharedEmptyArray = new Section[0];
private Section[] m_sections = SharedEmptyArray;
//
// Helper Methods
//
public void AddSection( Section sec )
{
int i = m_sections.Length;
while(i > 0)
{
var sec2 = m_sections[i-1];
if(sec2.Offset < sec.Offset)
{
break;
}
i--;
}
m_sections = ArrayUtility.InsertAtPositionOfNotNullArray( m_sections, i, sec );
}
//
// Access Methods
//
public Section[] Sections
{
get
{
return m_sections;
}
}
public uint TotalSize
{
get
{
uint size = 0;
foreach(var sec in m_sections)
{
size += sec.Size;
}
return size;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CodeTransformation.csproj
================================================
Debug
AnyCPU
9.0.21022
2.0
{186F31A3-EF89-4A25-B2D5-20070222AA01}
Library
Properties
Microsoft.Zelig.CodeGeneration.IR
Microsoft.Zelig.CodeGeneration.CodeTransformation
$(LlilumBuildRoot)\Host\obj\$(MSBuildProjectName)\
v4.5
true
full
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
DEBUG;TRACE
prompt
4
true
AllRules.ruleset
AnyCPU
false
pdbonly
true
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE
prompt
4
true
AllRules.ruleset
AnyCPU
false
$(LlilumBuildRoot)\Host\bin\$(Configuration)\
TRACE;DEBUG;DUMP_CONSTRAINTSYSTEM;TRACE_EVERY_SINGLE_IR_CHANGE;TRACE_EVERY_IR_CHANGE
true
AnyCPU
false
{186F31A3-EF89-4A25-B2D5-20070601AA01}
CommonPC
False
{186F31A3-EF89-4A25-B2D5-20060510AA01}
Normalized
False
{186F31A3-EF89-4A25-B2D5-20061218AA01}
Common
False
{186F31A3-EF89-4A25-B2D5-20060509AA01}
Kernel
False
{186F31A3-EF89-4A25-B2D5-20060720AA01}
TypeSystem
False
{186F31A3-EF89-4A25-B2D5-20070519AA01}
ArmProcessor
False
{46478CA2-8163-47A0-8C65-3ACFC21CE57F}
Win32Processor
False
{186F31A3-EF89-4A25-B2D5-20060603AA01}
IntermediateRepresentation
False
{0162c8ce-6641-4922-8664-f8a44356fbf7}
Llvm.NET
{186f31a3-ef89-4a25-b2d5-20060404aa01}
Importer
{37193a86-ba04-4a3e-9df8-656df455e952}
Elflib
False
..\..\..\External\Binaries\CSharpParser\Debug\CSharpParser.dll
3.5
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/AbstractHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method)]
public abstract class AbstractHandlerAttribute : Attribute
{
//
// State
//
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/CallClosureHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public sealed class CallClosureHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public Type Target;
//
// Constructor Methods
//
public CallClosureHandlerAttribute( Type target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/CallToWellKnownMethodHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public sealed class CallToWellKnownMethodHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public string Target;
//
// Constructor Methods
//
public CallToWellKnownMethodHandlerAttribute( string target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/CustomAttributeHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method)]
public sealed class CustomAttributeHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public string FieldName;
//
// Constructor Methods
//
public CustomAttributeHandlerAttribute( string fieldName )
{
this.FieldName = fieldName;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/CustomAttributeNotificationAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method,AllowMultiple=true)]
public sealed class CustomAttributeNotificationAttribute : Attribute
{
//
// State
//
public string Target;
//
// Constructor Methods
//
public CustomAttributeNotificationAttribute( string target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/MaximumOperatorLevelAfterPhaseExecutionAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// After running phase X, all the operators should be at most at level Y.
//
[AttributeUsage(AttributeTargets.Field, AllowMultiple=false)]
public sealed class MaximumOperatorLevelAfterPhaseExecutionAttribute : Attribute
{
//
// State
//
public readonly Operator.OperatorLevel Level;
//
// Constructor Methods
//
public MaximumOperatorLevelAfterPhaseExecutionAttribute( Operator.OperatorLevel level )
{
this.Level = level;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/NewEntityNotificationAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method,AllowMultiple=false)]
public sealed class NewEntityNotificationAttribute : Attribute
{
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/OperatorArgumentHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method)]
public sealed class OperatorArgumentHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public Type Target;
//
// Constructor Methods
//
public OperatorArgumentHandlerAttribute( Type target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/OperatorHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public sealed class OperatorHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public Type Target;
//
// Constructor Methods
//
public OperatorHandlerAttribute( Type target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/OptimizationHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Methods with this attribute get a chance to look at the ControlFlowGraphState during optimization phases.
//
[AttributeUsage(AttributeTargets.Method)]
public sealed class OptimizationHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public bool RunOnce;
public bool RunInExtendedSSAForm;
public bool RunInSSAForm;
public bool RunInNormalForm;
public string RunBefore;
public string RunAfter;
internal OptimizationHandlerAttribute caToRunBeforeThis;
internal OptimizationHandlerAttribute caToRunAfterThis;
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PhaseDisabledAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// After running phase X, all the operators should be at most at level Y.
//
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
public sealed class PhaseDisabledAttribute : Attribute
{
//
// State
//
// none
//
// Constructor Methods
//
public PhaseDisabledAttribute()
{
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PhaseFilterAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public sealed class PhaseFilterAttribute : Attribute
{
//
// State
//
public readonly Type Target;
//
// Constructor Methods
//
public PhaseFilterAttribute( Type target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PhaseLimitAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// After running phase X, all the operators should be at most at level Y.
//
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
public sealed class PhaseLimitAttribute : Attribute
{
//
// State
//
public readonly Operator.OperatorLevel Level;
//
// Constructor Methods
//
public PhaseLimitAttribute( Operator.OperatorLevel level )
{
this.Level = level;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PhaseOrderingAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Allows to position phase X in relation to other phases.
//
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class PhaseOrderingAttribute : Attribute
{
//
// State
//
public Type ExecuteBefore;
public Type ExecuteAfter;
public bool IsPipelineBlock;
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PostFlowGraphHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Methods with this attribute get a chance to look at the ControlFlowGraphState after everyone else.
//
[AttributeUsage(AttributeTargets.Method)]
public sealed class PostFlowGraphHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PostPhaseHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Methods with this attribute get a chance to look at the type system after a phase has executed.
//
[AttributeUsage(AttributeTargets.Method)]
public sealed class PostPhaseHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PreFlowGraphHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Methods with this attribute get a chance to look at the ControlFlowGraphState before everyone else.
//
[AttributeUsage(AttributeTargets.Method)]
public sealed class PreFlowGraphHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/PrePhaseHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
//
// Methods with this attribute get a chance to look at the type system before a phase has executed.
//
[AttributeUsage(AttributeTargets.Method)]
public sealed class PrePhaseHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
//
// Constructor Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/WellKnownFieldHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method)]
public sealed class WellKnownFieldHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public string Target;
//
// Constructor Methods
//
public WellKnownFieldHandlerAttribute( string target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/WellKnownMethodHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public sealed class WellKnownMethodHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public string Target;
//
// Constructor Methods
//
public WellKnownMethodHandlerAttribute( string target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Attributes/WellKnownTypeHandlerAttribute.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
[AttributeUsage(AttributeTargets.Method)]
public sealed class WellKnownTypeHandlerAttribute : AbstractHandlerAttribute
{
//
// State
//
public string Target;
//
// Constructor Methods
//
public WellKnownTypeHandlerAttribute( string target )
{
this.Target = target;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Controller.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define COLLECT_PERFORMANCE_DATA_FOR_CONTROLLER
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class Controller
{
//
// State
//
private readonly TypeSystemForCodeTransformation m_typeSystem;
private readonly CallsDataBase m_callsDatabase;
private readonly LinkedList< PhaseDriver > m_phases;
private PhaseDriver m_currentPhase;
//
// Constructor Methods
//
public Controller( TypeSystemForCodeTransformation typeSystem, List phases )
{
m_typeSystem = typeSystem;
m_callsDatabase = new CallsDataBase( );
m_phases = new LinkedList( );
//--//
var lst = new List( );
CreatePhaseDrivers( lst, phases );
var orderingForward = HashTableFactory.NewWithReferenceEquality>( );
var orderingBackward = HashTableFactory.NewWithReferenceEquality>( );
CollectPhaseOrderingConstraints( lst, orderingForward, orderingBackward );
ValidateConstraints( lst, orderingForward );
SortPhaseDrivers( lst, orderingBackward );
DumpPhaseOrdering( );
}
public Controller( TypeSystemForCodeTransformation typeSystem ) : this( typeSystem, null )
{
}
//
// Helper Methods
//
private void CreatePhaseDrivers( List lst, List userDisabledPhases )
{
var assembly = System.Reflection.Assembly.GetCallingAssembly();
foreach(Type t in assembly.GetTypes())
{
if(t.IsAbstract == false && t.IsSubclassOf( typeof(PhaseDriver) ))
{
bool fDisabled = false;
// check if this phase appears in the list crafted by the user
if( userDisabledPhases != null && userDisabledPhases.Count > 0 )
{
foreach( var p in userDisabledPhases )
{
if(t.Name == p)
{
fDisabled = true;
break;
}
}
}
// check if phase has been disabled through attribute
if( !fDisabled )
{
// check that this phase is not disabled
// disabled phases cannot run
var e = t.CustomAttributes.GetEnumerator( );
while( e.MoveNext( ) )
{
if( e.Current.AttributeType == typeof( PhaseDisabledAttribute ) )
{
fDisabled = true;
break;
}
}
}
var phase = (PhaseDriver)Activator.CreateInstance(t, this);
phase.Disabled = fDisabled;
lst.Add(phase);
}
}
}
private static void CollectPhaseOrderingConstraints( List < PhaseDriver > lst ,
GrowOnlyHashTable< PhaseDriver, List< PhaseDriver > > orderingForward ,
GrowOnlyHashTable< PhaseDriver, List< PhaseDriver > > orderingBackward )
{
foreach(var phase in lst)
{
var phaseAfter = FindPhaseByType( lst, phase.ExecuteAfter );
if(phaseAfter != null)
{
HashTableWithListFactory.AddUnique( orderingForward , phaseAfter, phase );
HashTableWithListFactory.AddUnique( orderingBackward, phase , phaseAfter );
}
var phaseBefore = FindPhaseByType( lst, phase.ExecuteBefore );
if(phaseBefore != null)
{
HashTableWithListFactory.AddUnique( orderingForward , phase , phaseBefore );
HashTableWithListFactory.AddUnique( orderingBackward, phaseBefore, phase );
}
}
}
private static void ValidateConstraints( List < PhaseDriver > lst ,
GrowOnlyHashTable< PhaseDriver, List< PhaseDriver > > orderingForward )
{
var set = SetFactory.NewWithReferenceEquality< PhaseDriver >();
foreach(var phase in lst)
{
set.Clear();
if(FindOrderingLoop( orderingForward, set, phase, phase ))
{
throw TypeConsistencyErrorException.Create( "Found loop in phase ordering constraints" );
}
}
}
private static bool FindOrderingLoop( GrowOnlyHashTable< PhaseDriver, List< PhaseDriver > > ordering ,
GrowOnlySet < PhaseDriver > set ,
PhaseDriver phaseStart ,
PhaseDriver phase )
{
set.Insert( phase );
List< PhaseDriver > lst;
if(ordering.TryGetValue( phase, out lst ))
{
foreach(var phaseNext in lst)
{
if(phaseNext == phaseStart)
{
return true;
}
if(FindOrderingLoop( ordering, set, phaseStart, phaseNext ))
{
return true;
}
}
}
return false;
}
private void SortPhaseDrivers( List < PhaseDriver > lst ,
GrowOnlyHashTable< PhaseDriver, List< PhaseDriver > > orderingBackward )
{
//
// Keep looking for a phase that doesn't have any pending predecessors.
// This is guaranteed to make progress, since we have already proved there are no loops.
//
while(lst.Count > 0)
{
foreach(var phase in lst)
{
List< PhaseDriver > lstPredecessors;
bool fAdd = true;
if(orderingBackward.TryGetValue( phase, out lstPredecessors ))
{
foreach(var phasePredecessor in lstPredecessors)
{
if(phasePredecessor.m_node == null)
{
//
// Predecessor not inserted, can't add to the list.
//
fAdd = false;
break;
}
}
}
if(fAdd)
{
phase.m_node = m_phases.AddLast( phase );
lst.Remove( phase );
break;
}
}
}
}
private void DumpPhaseOrdering()
{
Console.WriteLine("");
Console.WriteLine("Phase Ordering:");
foreach(var phase in m_phases)
{
if (phase.Disabled)
{
var color = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" {0}: {1} (Disabled)", phase.PhaseIndex, phase);
Console.ForegroundColor = color;
}
else
{
Console.WriteLine(" {0}: {1}", phase.PhaseIndex, phase);
}
}
Console.WriteLine( "" );
Console.WriteLine( "" );
}
//--//
public void ExecuteSteps( bool fGenerateImageOnly = false )
{
Console.WriteLine( "Compiling..." );
Console.WriteLine( "" );
//
// 1) Expand the Call Closure to include all the overrides of virtual methods.
// Question: should we wait until we know all the types used by the application?
//
// 2) For all the ForceDevirtualization types, find the implementation. Virtual calls should be changed to normal calls.
// Question: should we use a ClassExtension-like mechanism? Not for now.
//
// 3) ImplicitInstance == you cannot create objects for this type. For now, it's not-implemented!
//
// 4) ForceDevirtualization = there should be only one subclass used by the application
// => keep track of referenced types, marking some types as unavailable. For now, we could simplify and abort on multiple sub-classes.
//
RegisterPhases();
m_currentPhase = m_phases.First.Value;
while(m_currentPhase != null)
{
if(fGenerateImageOnly && ((m_currentPhase is Phases.GenerateImage) == false))
{
m_currentPhase = m_currentPhase.NextPhase;
continue;
}
if(m_currentPhase.Disabled)
{
var color = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine( "Skipping phase: {0}", m_currentPhase );
Console.ForegroundColor = color;
m_currentPhase = m_currentPhase.NextPhase;
continue;
}
using(new Transformations.ExecutionTiming( m_currentPhase.ToString() ))
{
m_typeSystem.NotifyCompilationPhaseInner( m_currentPhase );
#if COLLECT_PERFORMANCE_DATA_FOR_CONTROLLER
PerformanceCounters.ContextualTiming timing = new PerformanceCounters.ContextualTiming();
timing.Start( this, string.Format( "Phase__{0}", m_currentPhase ) );
#endif
var nextPhase = m_currentPhase.Execute();
#if COLLECT_PERFORMANCE_DATA_FOR_CONTROLLER
timing.Stop();
#endif
if(nextPhase != null)
{
foreach(var phase in m_phases)
{
phase.ValidatePhaseMovement( m_currentPhase, nextPhase );
}
}
m_currentPhase = nextPhase;
}
}
}
private void RegisterPhases()
{
var cache = m_typeSystem.GetEnvironmentService< IR.CompilationSteps.DelegationCache >();
cache.Register( new Handlers.MethodTransformations() );
cache.Register( new Handlers.ProtectRequiredEntities() );
cache.Register( new Handlers.WellKnownFieldHandlers() );
cache.Register( new Handlers.WellKnownMethodHandlers() );
cache.Register( new Handlers.OperatorHandlers_HighLevel() );
cache.Register( new Handlers.OperatorHandlers_HighLevelToMidLevel() );
cache.Register( new Handlers.OperatorHandlers_FromImplicitToExplicitExceptions() );
cache.Register( new Handlers.OperatorHandlers_ReferenceCountingGarbageCollection() );
cache.Register( new Handlers.OperatorHandlers_ConvertUnsupportedOperatorsToMethodCalls() );
cache.Register( new Handlers.OperatorHandlers_ExpandAggregateTypes() );
cache.Register( new Handlers.OperatorHandlers_MidLevelToLowLevel() );
cache.Register( new Handlers.Optimizations() );
m_typeSystem.PlatformAbstraction.RegisterForNotifications( m_typeSystem, cache );
m_typeSystem.CallingConvention .RegisterForNotifications( m_typeSystem, cache );
}
//--//
internal T FindPhase< T >() where T : PhaseDriver
{
return (T)FindPhaseByType( typeof(T) );
}
internal PhaseDriver FindPhaseByType( Type type )
{
return FindPhaseByType( m_phases, type );
}
private static PhaseDriver FindPhaseByType( IEnumerable< PhaseDriver > lst ,
Type type )
{
if(type != null)
{
foreach(var phase in lst)
{
if(phase.GetType() == type)
{
return phase;
}
}
}
return null;
}
//--//
//
// Access Methods
//
internal TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_typeSystem;
}
}
internal CallsDataBase CallsDatabase
{
get
{
return m_callsDatabase;
}
}
public GrowOnlyHashTable< MethodRepresentation, GrowOnlySet< object > > EntitiesReferencedByMethods
{
get
{
CHECKS.ASSERT( m_currentPhase.PhaseIndex > FindPhase< Phases.ComputeCallsClosure >().PhaseIndex, "Cannot access EntitiesReferencedByMethods property at phase {0}!", m_currentPhase );
var phase = this.FindPhase< Phases.ComputeCallsClosure >();
return phase.EntitiesReferencedByMethods;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/MethodTransformations.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class MethodTransformations
{
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations ) )]
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.PhaseFilter( typeof(Phases.MidLevelToLowLevelConversion ) )]
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes ) )]
[CompilationSteps.PhaseFilter( typeof(Phases.ReferenceCountingGarbageCollection) )]
[CompilationSteps.PostFlowGraphHandler()]
private static void ProcessFlowGraphAfterTransformations( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null)
{
if(Transformations.CommonMethodRedundancyElimination.Execute( cfg ))
{
nc.StopScan();
return;
}
cfg.DropDeadVariables();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PreFlowGraphHandler()]
private void InjectPrologueAndEpilogue( PhaseExecution.NotificationContext nc )
{
var inlineOptions = nc.TypeSystem.GetEnvironmentService( );
if( inlineOptions != null && !inlineOptions.InjectPrologAndEpilog )
return;
if(nc.Phase.ComparePositionTo< Phases.HighLevelTransformations >() >= 0 &&
nc.Phase.ComparePositionTo< Phases.ReduceTypeSystem >() < 0 )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null && cfg.SetProperty( "MethodWrappersAdded" ) == false)
{
var wkm = nc.TypeSystem.WellKnownMethods;
{
var prologueStart = cfg.GetInjectionPoint( BasicBlock.Qualifier.PrologueStart );
var prologueEnd = cfg.GetInjectionPoint( BasicBlock.Qualifier.PrologueEnd );
AddCallToWrapper( nc, prologueStart, prologueEnd, wkm.Microsoft_Zelig_Runtime_AbstractMethodWrapper_Prologue, wkm.Microsoft_Zelig_Runtime_AbstractMethodWrapper_Prologue2 );
}
{
var epilogueStart = cfg.GetInjectionPoint( BasicBlock.Qualifier.EpilogueStart );
var epilogueEnd = cfg.GetInjectionPoint( BasicBlock.Qualifier.EpilogueEnd );
AddCallToWrapper( nc, epilogueStart, epilogueEnd, wkm.Microsoft_Zelig_Runtime_AbstractMethodWrapper_Epilogue, wkm.Microsoft_Zelig_Runtime_AbstractMethodWrapper_Epilogue2 );
}
nc.StartScan();
}
}
}
private static void AddCallToWrapper( PhaseExecution.NotificationContext nc ,
BasicBlock targetStart ,
BasicBlock targetEnd ,
MethodRepresentation mdNormal ,
MethodRepresentation mdException )
{
if(targetStart != null)
{
var cfg = nc.CurrentCFG;
var ts = nc.TypeSystem;
var md = cfg.Method;
var attribs = md.ExpandedBuildTimeFlags;
var he = ts.ExtractHardwareExceptionSettingsForMethod( md );
var tdHelper = ts.PlatformAbstraction.GetMethodWrapperType();
var exHelper = ts.GenerateConstantForSingleton( tdHelper, DataManager.Attributes.Constant | DataManager.Attributes.SuitableForConstantPropagation );
Expression[] rhsHelper;
MethodRepresentation mdHelper;
if(ts.PlatformAbstraction.HasRegisterContextArgument( md ))
{
attribs |= MethodRepresentation.BuildTimeAttributes.SaveFullProcessorContext;
}
if(he == Runtime.HardwareException.None)
{
rhsHelper = ts.CreateConstantsFromObjects( exHelper, md.OwnerType.FullName, md.ToShortString(), attribs );
mdHelper = mdNormal;
}
else
{
rhsHelper = ts.CreateConstantsFromObjects( exHelper, md.OwnerType.FullName, md.ToShortString(), attribs, he );
mdHelper = mdException;
}
CallOperator callHelper;
MethodRepresentation mdHelperDirect = mdHelper.FindVirtualTarget( tdHelper );
if(mdHelperDirect != null)
{
callHelper = InstanceCallOperator.New( null, CallOperator.CallKind.Overridden, mdHelperDirect, rhsHelper, false );
}
else
{
callHelper = InstanceCallOperator.New( null, CallOperator.CallKind.Virtual, mdHelper, rhsHelper, false );
}
targetStart.AddOperator( callHelper );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.PreFlowGraphHandler()]
private static void ProcessFlowGraphBeforeExpandAggregateTypes( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null)
{
cfg.MapVariables();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertToSSA) )]
[CompilationSteps.PreFlowGraphHandler()]
private static void ConvertToSSA( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null)
{
if(Transformations.StaticSingleAssignmentForm.ConvertInto( cfg ))
{
nc.MarkAsModified();
}
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
///
/// Coerce constant call arguments to their target type. This saves having to inject a cast at translation time.
///
/// Context for this transformation.
[CompilationSteps.OperatorHandler(typeof(CallOperator))]
private void CoerceConstantParameters( PhaseExecution.NotificationContext nc )
{
CallOperator call = nc.GetOperatorAndThrowIfNotCall();
TypeRepresentation[] argTypes = call.TargetMethod.ThisPlusArguments;
Expression[] arguments = call.Arguments;
bool isIndirect = call is IndirectCallOperator;
// We always skip the 'this' pointer, so start at 1.
for( int i = 1 ; i < argTypes.Length; ++i )
{
CoerceConstantParameter(ref arguments[isIndirect ? (i + 1) : i], argTypes[i]);
}
}
private static void CoerceConstantParameter( ref Expression argExpr, TypeRepresentation targetType )
{
var constExpr = argExpr as ConstantExpression;
if( constExpr == null )
{
return;
}
if ( targetType != argExpr.Type )
{
// This works for all scalar numeric types, including enums.
ulong valueAsUInt64;
if( constExpr.GetAsRawUlong( out valueAsUInt64 ) )
{
object value = ConstantExpression.ConvertToType( targetType, valueAsUInt64 );
argExpr = new ConstantExpression( targetType, value );
}
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.OperatorHandler( typeof(CallOperator) )]
private static void AttemptDevirtualization( PhaseExecution.NotificationContext nc )
{
if(AttemptDevirtualization( nc.TypeSystem, nc.GetOperatorAndThrowIfNotCall() ))
{
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
public static bool AttemptDevirtualization( TypeSystemForCodeTransformation typeSystem ,
CallOperator call )
{
MethodRepresentation md = call.TargetMethod;
if(call.CallType == CallOperator.CallKind.Virtual)
{
if(!(md is VirtualMethodRepresentation) ||
md is FinalMethodRepresentation )
{
CallOperator callNew = InstanceCallOperator.New( call.DebugInfo, CallOperator.CallKind.Overridden, md, call.Results, call.Arguments, true );
call.SubstituteWithOperator( callNew, Operator.SubstitutionFlags.CopyAnnotations );
return true;
}
else
{
TypeRepresentation tdTarget = null;
{
TypeRepresentation tdForcedDevirtualization;
if(typeSystem.ForcedDevirtualizations.TryGetValue( md.OwnerType, out tdForcedDevirtualization ))
{
tdTarget = tdForcedDevirtualization;
}
}
if(tdTarget == null)
{
Expression exThis = call.FirstArgument;
TypeRepresentation tdThis = exThis.Type.UnderlyingType;
if(tdThis is ValueTypeRepresentation || (tdThis.Flags & TypeRepresentation.Attributes.Sealed) != 0)
{
tdTarget = tdThis;
}
else if(tdThis.IsSubClassOf( md.OwnerType, null ))
{
MethodRepresentation md2 = md.FindVirtualTarget( tdThis );
if((md2.Flags & MethodRepresentation.Attributes.Final) != 0)
{
tdTarget = tdThis;
}
}
if(tdTarget == null)
{
//
// BUGBUG: This is valid only if we are in bounded application mode!!!
//
tdTarget = typeSystem.FindSingleConcreteImplementation( tdThis );
}
}
if(tdTarget != null)
{
MethodRepresentation md2 = md.FindVirtualTarget( tdTarget );
CallOperator callNew = InstanceCallOperator.New( call.DebugInfo, CallOperator.CallKind.Overridden, md2, call.Results, call.Arguments, true );
call.SubstituteWithOperator( callNew, Operator.SubstitutionFlags.CopyAnnotations );
return true;
}
}
}
return false;
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof( Phases.ReferenceCountingGarbageCollection ) )]
[CompilationSteps.PreFlowGraphHandler( )]
private static void InjectReferenceCountingSetupAndCleanup( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null && cfg.SetProperty( "ReferenceCountingAdded" ) == false)
{
var ts = nc.TypeSystem;
if(!ts.ShouldExcludeMethodFromReferenceCounting( cfg.Method ))
{
bool modified = false;
var phase = (Phases.ReferenceCountingGarbageCollection)nc.Phase;
var wkm = ts.WellKnownMethods;
var defChains = cfg.DataFlow_DefinitionChains;
var useChains = cfg.DataFlow_UseChains;
var variables = cfg.DataFlow_SpanningTree_Variables;
var arguments = cfg.Arguments;
GrowOnlySet needRelease = SetFactory.New( );
var prologueStart = cfg.GetInjectionPoint( BasicBlock.Qualifier.PrologueStart );
var epilogueStart = cfg.GetInjectionPoint( BasicBlock.Qualifier.EpilogueStart );
cfg.ResetCacheCheckpoint( );
var mdAddRef = wkm.ObjectHeader_AddReference;
var mdRelease = wkm.ObjectHeader_ReleaseReference;
var returnVariable = FindReturnVariable( cfg, defChains, useChains );
foreach(var arg in arguments)
{
var skipReferenceCounting = true;
// Skip over the first argument (this pointer)
// and arguments that aren't being used (as indicated by an invalid spanning tree index)
// and arguments that are not the right types
if(arg.Number != 0 && arg.SpanningTreeIndex >= 0 && ts.IsReferenceCountingType( arg.Type ))
{
var defChain = defChains[ arg.SpanningTreeIndex ];
CHECKS.ASSERT( defChain.Length > 0 && defChain[ 0 ] is InitialValueOperator,
"Argument {0} does not have an InitialValueOperator", arg);
// Looking at the definition chain, we only want to AddRef/Release arguments that are modified
// within the method, so we can manage the lifetime of the new value accordingly. If the argument is
// never modified, then the caller would hold a reference to guarantee its lifetime for the
// duration of the method call.
if(defChain.Length > 1)
{
var rhsAddref = ts.AddTypePointerToArgumentsOfStaticMethod( mdAddRef, arg );
var callAddref = StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdAddRef, rhsAddref );
prologueStart.AddOperator( callAddref );
phase.IncrementInjectionCount( mdAddRef );
modified = true;
// Do not release the return variable because we need to pass the
// ref count back to the caller on return.
if(arg != returnVariable)
{
needRelease.Insert( arg );
}
skipReferenceCounting = false;
}
}
if(skipReferenceCounting)
{
arg.SkipReferenceCounting = true;
}
}
var skippables = FindSkippableVariables( cfg, variables, defChains, useChains );
foreach(var variable in variables)
{
if(skippables[ variable.SpanningTreeIndex ])
{
variable.SkipReferenceCounting = true;
}
else if (!(variable is ArgumentVariableExpression))
{
var nullExpression = new ConstantExpression( variable.Type, null );
var op = SingleAssignmentOperator.New( null, variable, nullExpression );
prologueStart.AddOperator( op );
modified = true;
phase.AddToModifiedOperator( op );
// Do not release the return variable because we need to pass the
// ref count back to the caller on return.
if(variable != returnVariable)
{
needRelease.Insert( variable );
}
}
}
if(epilogueStart != null)
{
foreach(var variable in needRelease)
{
var rhsRelease = ts.AddTypePointerToArgumentsOfStaticMethod( mdRelease, variable );
var callRelease = StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdRelease, rhsRelease );
epilogueStart.AddOperator( callRelease );
phase.IncrementInjectionCount( mdRelease );
modified = true;
}
// A ref counting return variable should carry a ref count to pass on to the caller,
// so if we skip reference counting on the variable, we'd need to take a ref count
// prior to returning.
if( returnVariable != null &&
returnVariable.SkipReferenceCounting &&
ts.IsReferenceCountingType( returnVariable.Type ))
{
var rhsAddRef = ts.AddTypePointerToArgumentsOfStaticMethod( mdAddRef, returnVariable );
var callAddRef = StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdAddRef, rhsAddRef );
epilogueStart.AddOperator( callAddRef );
phase.IncrementInjectionCount( mdAddRef );
modified = true;
}
}
if(modified)
{
nc.StartScan( );
}
cfg.AssertNoCacheRefreshSinceCheckpoint( );
}
}
}
private static VariableExpression FindReturnVariable(
ControlFlowGraphStateForCodeTransformation cfg,
Operator[][] defChains,
Operator[][] useChains )
{
var ts = cfg.TypeSystem;
// Find the return variable, if any.
var returnOperator = (ReturnControlOperator)cfg.ExitBasicBlock?.FlowControl;
var returnVariable = returnOperator?.Arguments.Length > 0 ? returnOperator.FirstArgument as VariableExpression : null;
if(returnVariable != null && ts.IsReferenceCountingType( returnVariable.Type ))
{
var returnVarSubstitute = FindReturnVariableSubstitute( defChains, useChains, returnVariable );
if(returnVarSubstitute != null)
{
returnVariable.SkipReferenceCounting = true;
returnVariable = returnVarSubstitute;
}
}
return returnVariable;
}
// If we can find the following pattern:
// tmp = local;
// ... <== additional code OK, as long as local is not changed
// return tmp;
// then we can avoid calling AddReference on tmp and ReleaseReference on local.
// Instead, just hand off the existing ref count on local on return.
private static VariableExpression FindReturnVariableSubstitute(
Operator[][] defChains,
Operator[][] useChains,
VariableExpression returnVariable )
{
// Find the pattern
var assignOp = ControlFlowGraphState.CheckSingleDefinition( defChains, returnVariable ) as SingleAssignmentOperator;
var returnOp = ControlFlowGraphState.CheckSingleUse ( useChains, returnVariable ) as ReturnControlOperator;
if(assignOp == null || returnOp == null)
{
return null;
}
var returnVarCandidate = assignOp.FirstArgument as VariableExpression;
if(returnVarCandidate == null)
{
return null;
}
// If we ever take the address of the expression, assume it can be modified.
foreach(Operator op in useChains[ returnVarCandidate.SpanningTreeIndex ])
{
if(op is AddressAssignmentOperator)
{
return null;
}
}
// Gather information about where the substitute is being defined / written
var substituteDefChain = defChains[ returnVarCandidate.SpanningTreeIndex ];
var substituteDefBasicBlocks = SetFactory.New( );
foreach(Operator defOp in substituteDefChain)
{
substituteDefBasicBlocks.Insert( defOp.BasicBlock );
}
// Starting with the basic block that the "tmp = local" assignment took place,
// find out if local is being redefined in this basic block.
var currentBasicBlock = assignOp.BasicBlock;
if(substituteDefBasicBlocks.Contains( currentBasicBlock ))
{
// If true, we're OK as long as those definitions happen after the assign operator.
var currentBlockDefs = new List( substituteDefChain ).FindAll(
defOp => defOp.BasicBlock == currentBasicBlock );
if(currentBlockDefs.TrueForAll(
defOp => defOp.GetBasicBlockIndex( ) < assignOp.GetBasicBlockIndex( ) ))
{
// Move on to the next basic block, as long as there's no branches
var flowCtrl = currentBasicBlock.FlowControl as UnconditionalControlOperator;
if(flowCtrl != null)
{
currentBasicBlock = flowCtrl.TargetBranch;
}
else
{
return null;
}
}
else
{
return null;
}
}
// Go through the rest of the basic blocks to make sure local is not redefined,
// and the control flow is linear.
while(currentBasicBlock != returnOp.BasicBlock)
{
if(!substituteDefBasicBlocks.Contains( currentBasicBlock ))
{
// Move on to the next basic block, as long as there's no branches
var flowCtrl = currentBasicBlock.FlowControl as UnconditionalControlOperator;
if(flowCtrl != null)
{
currentBasicBlock = flowCtrl.TargetBranch;
}
else
{
return null;
}
}
else
{
return null;
}
}
return returnVarCandidate;
}
private static BitVector FindSkippableVariables(
ControlFlowGraphStateForCodeTransformation cfg,
VariableExpression[] variables,
Operator[][] defChains,
Operator[][] useChains )
{
var skippables = new BitVector( variables.Length );
// In strict mode, we assume any object can be accessed by multiple threads at the same time
// so we need to take a local reference to all field / element / indirect load.
var allowLoads =
cfg.TypeSystem.ReferenceCountingGarbageCollectionStatus !=
TypeSystemForCodeTransformation.ReferenceCountingStatus.EnabledStrict;
// In this initial pass, we go through each of the variable and mark off the variables that
// are already marked skippable and of the wrong types, as well as calling the IsVariableSkippable
// helper with the incomplete skippables information.
foreach(var variable in variables)
{
int i = variable.SpanningTreeIndex;
if( !cfg.TypeSystem.IsReferenceCountingType( variable.Type ) ||
variable.SkipReferenceCounting ||
IsVariableSkippable( defChains[ i ], useChains[ i ], skippables, allowLoads ))
{
skippables[ i ] = true;
}
}
// We will repeatedly call IsVariableSkippable helper on all variables with the most up-to-date
// skippables information until it stops changing. This will help us get the case where a variable
// is assigned from a previously marked skippable variable.
bool done;
do
{
done = true;
foreach(var variable in variables)
{
int i = variable.SpanningTreeIndex;
if(!skippables[ i ])
{
if (IsVariableSkippable( defChains[ i ], useChains[ i ], skippables, allowLoads ))
{
skippables[ i ] = true;
done = false;
}
}
}
}
while(!done);
return skippables;
}
private static bool IsVariableSkippable( Operator[] defChain, Operator[] useChain, BitVector skippables, bool allowLoads )
{
// A variable is skippable only if all its definitions match the criteria.
foreach(var defOp in defChain)
{
if(defOp is CallOperator)
{
// A ref count is always passed by return, so can't skip.
return false;
}
else if (defOp is SingleAssignmentOperator)
{
var assignOp = (SingleAssignmentOperator)defOp;
var source = assignOp.FirstArgument;
// Single assignment is OK if we're assigning from a constant or another skippable
// variable.
if( source is ConstantExpression ||
( source is VariableExpression && skippables[ source.SpanningTreeIndex ] ))
{
continue;
}
return false;
}
else if(defOp is LoadInstanceFieldOperator ||
defOp is LoadElementOperator ||
defOp is LoadIndirectOperator)
{
if(allowLoads)
{
// Special case for volatile fields -- we need to properly ref count them to ensure
// correctness.
if(defOp is LoadInstanceFieldOperator)
{
var fieldOp = (LoadInstanceFieldOperator)defOp;
if(( fieldOp.Field.Flags & FieldRepresentation.Attributes.IsVolatile ) != 0)
{
return false;
}
}
continue;
}
else
{
return false;
}
}
else if (defOp is InitialValueOperator)
{
// First assignment of an argument -- we're OK since the caller will always have a ref count
continue;
}
else
{
CHECKS.ASSERT( false, "Unexpected definition operators: %s", defOp );
}
}
// In addition, if the variable's address is taken, we have to assume that it can be use
// elsewhere where it might be addref / released, so we cannot skip it.
foreach(var useOp in useChain)
{
if(useOp is AddressAssignmentOperator)
{
return false;
}
}
return true;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_ConvertUnsupportedOperatorsToMethodCalls.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_ConvertUnsupportedOperatorsToMethodCalls
{
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(BinaryOperator) )]
private static void Handle_BinaryOperator( PhaseExecution.NotificationContext nc )
{
BinaryOperator op = (BinaryOperator)nc.CurrentOperator;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
WellKnownMethods wkm = ts.WellKnownMethods;
VariableExpression exRes = op.FirstResult;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
TypeRepresentation tdRes = exRes .Type;
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
uint sizeRes = tdRes .SizeOfHoldingVariableInWords;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
bool fSigned = op.Signed;
if(sizeSrc1 != sizeSrc2)
{
switch(op.Alu)
{
case BinaryOperator.ALU.SHL:
case BinaryOperator.ALU.SHR:
CHECKS.ASSERT( sizeSrc2 == 1, "Incompatible input for {0}", op );
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
if(sizeSrc1 != sizeRes)
{
if(op.Alu != BinaryOperator.ALU.MUL)
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
if((tdSrc1.IsNumeric == false || tdSrc1.IsInteger) &&
(tdSrc2.IsNumeric == false || tdSrc2.IsInteger) )
{
if(sizeSrc1 == 1)
{
switch(op.Alu)
{
case BinaryOperator.ALU.DIV:
case BinaryOperator.ALU.REM:
{
MethodRepresentation md;
if(fSigned)
{
switch(op.Alu)
{
case BinaryOperator.ALU.DIV: md = wkm.Helpers_BinaryOperations_IntDiv; break;
case BinaryOperator.ALU.REM: md = wkm.Helpers_BinaryOperations_IntRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
switch(op.Alu)
{
case BinaryOperator.ALU.DIV: md = wkm.Helpers_BinaryOperations_UintDiv; break;
case BinaryOperator.ALU.REM: md = wkm.Helpers_BinaryOperations_UintRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
ts.SubstituteWithCallToHelper( md, op );
nc.MarkAsModified();
}
break;
}
}
else if(sizeSrc1 == 2)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL:
case BinaryOperator.ALU.DIV:
case BinaryOperator.ALU.REM:
{
MethodRepresentation md;
if(fSigned)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL: md = wkm.Helpers_BinaryOperations_LongMul; break;
case BinaryOperator.ALU.DIV: md = wkm.Helpers_BinaryOperations_LongDiv; break;
case BinaryOperator.ALU.REM: md = wkm.Helpers_BinaryOperations_LongRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL: md = wkm.Helpers_BinaryOperations_UlongMul; break;
case BinaryOperator.ALU.DIV: md = wkm.Helpers_BinaryOperations_UlongDiv; break;
case BinaryOperator.ALU.REM: md = wkm.Helpers_BinaryOperations_UlongRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
ts.SubstituteWithCallToHelper( md, op );
nc.MarkAsModified();
}
break;
case BinaryOperator.ALU.SHL:
case BinaryOperator.ALU.SHR:
{
ConstantExpression exShift = exSrc2 as ConstantExpression;
//
// Conversion from 64 to 32 bits? Or from 32 to 64 bits?
//
if(exShift != null && exShift.Value is int && (int)exShift.Value == 32)
{
//
// This will be expanded later.
//
}
else
{
MethodRepresentation md;
if(fSigned)
{
switch(op.Alu)
{
case BinaryOperator.ALU.SHL: md = wkm.Helpers_BinaryOperations_LongShl; break;
case BinaryOperator.ALU.SHR: md = wkm.Helpers_BinaryOperations_LongShr; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
switch(op.Alu)
{
case BinaryOperator.ALU.SHL: md = wkm.Helpers_BinaryOperations_UlongShl; break;
case BinaryOperator.ALU.SHR: md = wkm.Helpers_BinaryOperations_UlongShr; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
ts.SubstituteWithCallToHelper( md, op );
nc.MarkAsModified();
}
}
break;
}
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_ExpandAggregateTypes.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_ExpandAggregateTypes
{
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(InitialValueOperator) )]
private static void Handle_InitialValueOperator( PhaseExecution.NotificationContext nc )
{
InitialValueOperator op = (InitialValueOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exDst = op.FirstResult;
Expression[] dstFragments = cfg.GetFragmentsForExpression( exDst );
foreach(Expression dstFragment in dstFragments)
{
InitialValueOperator opNew = InitialValueOperator.New( debugInfo, (VariableExpression)dstFragment );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(SingleAssignmentOperator) )]
private static void Handle_AssignmentOperator( PhaseExecution.NotificationContext nc )
{
SingleAssignmentOperator op = (SingleAssignmentOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.FirstArgument;
VariableExpression exDst = op.FirstResult;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
Expression[] dstFragments = cfg.GetFragmentsForExpression( exDst );
uint srcSize = (uint)srcFragments.Length;
uint dstSize = (uint)dstFragments.Length;
if(srcSize != dstSize)
{
if(srcSize == 1)
{
for(uint offset = 0; offset < dstSize; offset++)
{
PartialAssignmentOperator opNew = PartialAssignmentOperator.New( debugInfo, (VariableExpression)dstFragments[offset], 0, srcFragments[0], offset );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
}
else if(dstSize == 1)
{
for(uint offset = 0; offset < srcSize; offset++)
{
PartialAssignmentOperator opNew = PartialAssignmentOperator.New( debugInfo, (VariableExpression)srcFragments[0], offset, dstFragments[offset], 0 );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected kind of assignment: {0}", op );
}
}
else
{
CHECKS.ASSERT( exSrc.Type.SizeOfHoldingVariableInWords == exDst.Type.SizeOfHoldingVariableInWords, "Assignments between elements of different sizes not supported at IR level: {0} <= {1}", exSrc, exDst );
if(srcSize == 1)
{
SingleAssignmentOperator opNew = SingleAssignmentOperator.New( debugInfo, (VariableExpression)dstFragments[0], srcFragments[0] );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
else
{
for(int offset = 0; offset < srcSize; offset++)
{
SingleAssignmentOperator opNew = SingleAssignmentOperator.New( debugInfo, (VariableExpression)dstFragments[offset], srcFragments[offset] );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
}
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(AddressAssignmentOperator) )]
private static void Handle_AddressAssignmentOperator( PhaseExecution.NotificationContext nc )
{
AddressAssignmentOperator op = (AddressAssignmentOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.FirstArgument;
VariableExpression exDst = op.FirstResult;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
Expression[] dstFragments = cfg.GetFragmentsForExpression( exDst );
CHECKS.ASSERT( exDst.Type.SizeOfHoldingVariableInWords == 1, "Pointer {0} is wider than a word", exDst );
CHECKS.ASSERT( srcFragments[0] is StackLocationExpression , "Cannot take address of {0}, expecting a stack location", srcFragments[0] );
AddressAssignmentOperator opNew = AddressAssignmentOperator.New( debugInfo, (VariableExpression)dstFragments[0], srcFragments[0] );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
opNew.AddAnnotation( NotNullAnnotation.Create( ts ) );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(CompareConditionalControlOperator) )]
private static void Handle_CompareConditionalControlOperator( PhaseExecution.NotificationContext nc )
{
CompareConditionalControlOperator op = (CompareConditionalControlOperator)nc.CurrentOperator;
//--//
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
Expression[] src1Fragments = cfg.GetFragmentsForExpression( exSrc1 );
Expression[] src2Fragments = cfg.GetFragmentsForExpression( exSrc2 );
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
bool fSigned = op.Signed;
CHECKS.ASSERT( sizeSrc1 == sizeSrc2, "Cannot compare entities of different size: {0} <=> {1}", exSrc1, exSrc2 );
//--//
ConditionCodeExpression.Comparison condition;
switch(op.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ:
condition = ConditionCodeExpression.Comparison.Equal;
break;
case CompareAndSetOperator.ActionCondition.GE:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame;
}
break;
case CompareAndSetOperator.ActionCondition.GT:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedGreaterThan;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedHigherThan;
}
break;
case CompareAndSetOperator.ActionCondition.LE:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedLessThanOrEqual;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame;
}
break;
case CompareAndSetOperator.ActionCondition.LT:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedLessThan;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedLowerThan;
}
break;
case CompareAndSetOperator.ActionCondition.NE:
condition = ConditionCodeExpression.Comparison.NotEqual;
break;
default: throw TypeConsistencyErrorException.Create( "Unexpected value {0} in {1}", op.Condition, op );
}
//--//
if(exSrc1 is ConstantExpression)
{
//
// Swap the left and right operands and change the direction of disequality conditions.
//
Expression[] tmp;
tmp = src1Fragments;
src1Fragments = src2Fragments;
src2Fragments = tmp;
switch(condition)
{
case ConditionCodeExpression.Comparison.Equal : /* Keep the same */ break;
case ConditionCodeExpression.Comparison.NotEqual : /* Keep the same */ break;
case ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame : condition = ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame ; break;
case ConditionCodeExpression.Comparison.UnsignedLowerThan : condition = ConditionCodeExpression.Comparison.UnsignedHigherThan ; break;
case ConditionCodeExpression.Comparison.UnsignedHigherThan : condition = ConditionCodeExpression.Comparison.UnsignedLowerThan ; break;
case ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame : condition = ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame; break;
case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual : condition = ConditionCodeExpression.Comparison.SignedLessThanOrEqual ; break;
case ConditionCodeExpression.Comparison.SignedLessThan : condition = ConditionCodeExpression.Comparison.SignedGreaterThan ; break;
case ConditionCodeExpression.Comparison.SignedGreaterThan : condition = ConditionCodeExpression.Comparison.SignedLessThan ; break;
case ConditionCodeExpression.Comparison.SignedLessThanOrEqual : condition = ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported compare operation: {0}", op );
}
}
if(tdSrc1.IsFloatingPoint &&
tdSrc2.IsFloatingPoint )
{
CHECKS.ASSERT( src1Fragments.Length == 1, "Expecting left argument in a single floating point register: {0}" , op );
CHECKS.ASSERT( src2Fragments.Length == 1, "Expecting right argument in a single floating point register: {0}", op );
ConditionCodeExpression cc = cfg.AllocateConditionCode();
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, src1Fragments[0], src2Fragments[0] ) );
//--//
ConditionCodeConditionalControlOperator opNew = ConditionCodeConditionalControlOperator.New( debugInfo, condition, cc, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if((tdSrc1.IsNumeric == false || tdSrc1.IsInteger) &&
(tdSrc2.IsNumeric == false || tdSrc2.IsInteger) )
{
ConditionCodeExpression cc = cfg.AllocateConditionCode();
if(sizeSrc1 == 1)
{
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, src1Fragments[0], src2Fragments[0] ) );
//--//
ConditionCodeConditionalControlOperator opNew = ConditionCodeConditionalControlOperator.New( debugInfo, condition, cc, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(sizeSrc1 == 2)
{
op.AddOperatorBefore( LongCompareOperator.New( debugInfo, cc, src1Fragments[0], src1Fragments[1], src2Fragments[0], src2Fragments[1] ) );
//--//
ConditionCodeConditionalControlOperator opNew = ConditionCodeConditionalControlOperator.New( debugInfo, condition, cc, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported compare operation larger than 64 bits: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported mixed-mode compare operation: {0}", op );
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(CompareAndSetOperator) )]
private static void Handle_CompareAndSetOperator( PhaseExecution.NotificationContext nc )
{
CompareAndSetOperator op = (CompareAndSetOperator)nc.CurrentOperator;
//--//
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] src1Fragments = cfg.GetFragmentsForExpression( exSrc1 );
Expression[] src2Fragments = cfg.GetFragmentsForExpression( exSrc2 );
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
bool fSigned = op.Signed;
CHECKS.ASSERT( resFragments.Length == 1, "The lvalue of CompareAndSetOperator should be a 32bit word: {0}", op );
CHECKS.ASSERT( sizeSrc1 == sizeSrc2, "Cannot compare entities of different size: {0} <=> {1}", exSrc1, exSrc2 );
//--//
ConditionCodeExpression.Comparison condition;
switch(op.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ:
condition = ConditionCodeExpression.Comparison.Equal;
break;
case CompareAndSetOperator.ActionCondition.GE:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame;
}
break;
case CompareAndSetOperator.ActionCondition.GT:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedGreaterThan;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedHigherThan;
}
break;
case CompareAndSetOperator.ActionCondition.LE:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedLessThanOrEqual;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame;
}
break;
case CompareAndSetOperator.ActionCondition.LT:
if(fSigned)
{
condition = ConditionCodeExpression.Comparison.SignedLessThan;
}
else
{
condition = ConditionCodeExpression.Comparison.UnsignedLowerThan;
}
break;
case CompareAndSetOperator.ActionCondition.NE:
condition = ConditionCodeExpression.Comparison.NotEqual;
break;
default: throw TypeConsistencyErrorException.Create( "Unexpected value {0} in {1}", op.Condition, op );
}
//--//
if(exSrc1 is ConstantExpression)
{
//
// Swap the left and right operands and change the direction of disequality conditions.
//
Expression[] tmp;
tmp = src1Fragments;
src1Fragments = src2Fragments;
src2Fragments = tmp;
switch(condition)
{
case ConditionCodeExpression.Comparison.Equal : /* Keep the same */ break;
case ConditionCodeExpression.Comparison.NotEqual : /* Keep the same */ break;
case ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame : condition = ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame ; break;
case ConditionCodeExpression.Comparison.UnsignedLowerThan : condition = ConditionCodeExpression.Comparison.UnsignedHigherThan ; break;
case ConditionCodeExpression.Comparison.UnsignedHigherThan : condition = ConditionCodeExpression.Comparison.UnsignedLowerThan ; break;
case ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame : condition = ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame; break;
case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual : condition = ConditionCodeExpression.Comparison.SignedLessThanOrEqual ; break;
case ConditionCodeExpression.Comparison.SignedLessThan : condition = ConditionCodeExpression.Comparison.SignedGreaterThan ; break;
case ConditionCodeExpression.Comparison.SignedGreaterThan : condition = ConditionCodeExpression.Comparison.SignedLessThan ; break;
case ConditionCodeExpression.Comparison.SignedLessThanOrEqual : condition = ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported compare operation: {0}", op );
}
}
if(tdSrc1.IsFloatingPoint &&
tdSrc2.IsFloatingPoint )
{
CHECKS.ASSERT( src1Fragments.Length == 1, "Expecting left argument in a single floating point register: {0}" , op );
CHECKS.ASSERT( src2Fragments.Length == 1, "Expecting right argument in a single floating point register: {0}", op );
ConditionCodeExpression cc = cfg.AllocateConditionCode();
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, src1Fragments[0], src2Fragments[0] ) );
//--//
SetIfConditionIsTrueOperator opNew = SetIfConditionIsTrueOperator.New( debugInfo, condition, (VariableExpression)resFragments[0], cc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if((tdSrc1.IsNumeric == false || tdSrc1.IsInteger) &&
(tdSrc2.IsNumeric == false || tdSrc2.IsInteger) )
{
ConditionCodeExpression cc = cfg.AllocateConditionCode();
if(sizeSrc1 == 1)
{
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, src1Fragments[0], src2Fragments[0] ) );
//--//
SetIfConditionIsTrueOperator opNew = SetIfConditionIsTrueOperator.New( debugInfo, condition, (VariableExpression)resFragments[0], cc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(sizeSrc1 == 2)
{
op.AddOperatorBefore( LongCompareOperator.New( debugInfo, cc, src1Fragments[0], src1Fragments[1], src2Fragments[0], src2Fragments[1] ) );
//--//
SetIfConditionIsTrueOperator opNew = SetIfConditionIsTrueOperator.New( debugInfo, condition, (VariableExpression)resFragments[0], cc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported compare operation larger than 64 bits: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported mixed-mode compare operation: {0}", op );
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(AbstractBinaryOperator) )]
private static void Handle_BinaryOperator( PhaseExecution.NotificationContext nc )
{
var op = (AbstractBinaryOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] src1Fragments = cfg.GetFragmentsForExpression( exSrc1 );
Expression[] src2Fragments = cfg.GetFragmentsForExpression( exSrc2 );
TypeRepresentation tdRes = exRes .Type;
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
uint sizeRes = tdRes .SizeOfHoldingVariableInWords;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
bool fSigned = op.Signed;
var alu = op.Alu;
if(sizeSrc1 != sizeSrc2)
{
switch(op.Alu)
{
case BinaryOperator.ALU.SHL:
case BinaryOperator.ALU.SHR:
CHECKS.ASSERT( sizeSrc2 == 1, "Incompatible input for {0}", op );
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
if(sizeSrc1 != sizeRes)
{
if(alu != BinaryOperator.ALU.MUL)
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
if(tdSrc1.IsFloatingPoint &&
tdSrc2.IsFloatingPoint )
{
CHECKS.ASSERT( resFragments .Length == 1, "Expecting result in a single floating point register: {0}" , op );
CHECKS.ASSERT( src1Fragments.Length == 1, "Expecting left argument in a single floating point register: {0}" , op );
CHECKS.ASSERT( src2Fragments.Length == 1, "Expecting right argument in a single floating point register: {0}", op );
VariableExpression newRes = (VariableExpression)resFragments [0];
Expression newSrc1 = src1Fragments[0];
Expression newSrc2 = src2Fragments[0];
AbstractBinaryOperator opNew;
if (op is BinaryOperator ) { opNew = BinaryOperator .New( debugInfo, alu, fSigned, false, newRes, newSrc1, newSrc2 ); }
else if(op is BinaryOperatorWithCarryIn ) { opNew = BinaryOperatorWithCarryIn .New( debugInfo, alu, fSigned, false, newRes, newSrc1, newSrc2, (VariableExpression)op.ThirdArgument ); }
else if(op is BinaryOperatorWithCarryInAndOut) { opNew = BinaryOperatorWithCarryInAndOut.New( debugInfo, alu, fSigned, false, newRes, op.SecondResult, newSrc1, newSrc2, (VariableExpression)op.ThirdArgument ); }
else if(op is BinaryOperatorWithCarryOut ) { opNew = BinaryOperatorWithCarryOut .New( debugInfo, alu, fSigned, false, newRes, op.SecondResult, newSrc1, newSrc2 ); }
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
else if((tdSrc1.IsNumeric == false || tdSrc1.IsInteger) &&
(tdSrc2.IsNumeric == false || tdSrc2.IsInteger) )
{
if(sizeSrc1 == 1)
{
switch(alu)
{
case BinaryOperator.ALU.DIV:
case BinaryOperator.ALU.REM:
{
//
// These should have been removed by a previous phase.
//
throw TypeConsistencyErrorException.Create( "Unexpected operator: {0}", op );
}
default:
if(sizeRes == 1)
{
VariableExpression newRes = (VariableExpression)resFragments [0];
Expression newSrc1 = src1Fragments[0];
Expression newSrc2 = src2Fragments[0];
AbstractBinaryOperator opNew;
if (op is BinaryOperator ) { opNew = BinaryOperator .New( debugInfo, alu, fSigned, false, newRes, newSrc1, newSrc2 ); }
else if(op is BinaryOperatorWithCarryIn ) { opNew = BinaryOperatorWithCarryIn .New( debugInfo, alu, fSigned, false, newRes, newSrc1, newSrc2, (VariableExpression)op.ThirdArgument ); }
else if(op is BinaryOperatorWithCarryInAndOut) { opNew = BinaryOperatorWithCarryInAndOut.New( debugInfo, alu, fSigned, false, newRes, op.SecondResult, newSrc1, newSrc2, (VariableExpression)op.ThirdArgument ); }
else if(op is BinaryOperatorWithCarryOut ) { opNew = BinaryOperatorWithCarryOut .New( debugInfo, alu, fSigned, false, newRes, op.SecondResult, newSrc1, newSrc2 ); }
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
else if(sizeRes == 2)
{
VariableExpression newResLo = (VariableExpression)resFragments [0];
VariableExpression newResHi = (VariableExpression)resFragments [1];
Expression newSrc1 = src1Fragments[0];
Expression newSrc2 = src2Fragments[0];
if(op is BinaryOperator)
{
var opNew = LongBinaryOperator.New( debugInfo, alu, fSigned, false, newResLo, newResHi, newSrc1, newSrc2 );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator: {0}", op );
}
break;
}
}
else if(sizeSrc1 == 2)
{
switch(alu)
{
case BinaryOperator.ALU.ADD:
case BinaryOperator.ALU.SUB:
if(op is BinaryOperator)
{
ConditionCodeExpression cc = cfg.AllocateConditionCode();
var opLow = BinaryOperatorWithCarryOut.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[0], cc, src1Fragments[0], src2Fragments[0] );
op.AddOperatorBefore( opLow );
var opHigh = BinaryOperatorWithCarryIn.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[1], src1Fragments[1], src2Fragments[1], cc );
op.AddOperatorBefore( opHigh );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
break;
case BinaryOperator.ALU.MUL:
case BinaryOperator.ALU.DIV:
case BinaryOperator.ALU.REM:
{
//
// These should have been removed by a previous phase.
//
throw TypeConsistencyErrorException.Create( "Unexpected operator: {0}", op );
}
case BinaryOperator.ALU.AND:
case BinaryOperator.ALU.OR :
case BinaryOperator.ALU.XOR:
if(op is BinaryOperator)
{
BinaryOperator opLow = BinaryOperator.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[0], src1Fragments[0], src2Fragments[0] );
op.AddOperatorBefore( opLow );
BinaryOperator opHigh = BinaryOperator.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[1], src1Fragments[1], src2Fragments[1] );
op.AddOperatorBefore( opHigh );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
break;
case BinaryOperator.ALU.SHL:
case BinaryOperator.ALU.SHR:
if(op is BinaryOperator)
{
ConstantExpression exShift = src2Fragments[0] as ConstantExpression;
//
// Conversion from 64 to 32 bits? Or from 32 to 64 bits?
//
if(exShift != null && exShift.Value is int && (int)exShift.Value == 32)
{
Operator opLow;
Operator opHigh;
switch(alu)
{
case BinaryOperator.ALU.SHL:
//
// Assign low part of Left to high part of Res, clear low part of Res.
//
opLow = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resFragments[0], ts.CreateConstant( (int)0 ) );
opHigh = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resFragments[1], src1Fragments[0] );
break;
case BinaryOperator.ALU.SHR:
if(fSigned)
{
//
// Assign high part of Left to low part of Res, sign extend high part of Res.
//
opLow = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resFragments[0], src1Fragments[1] );
opHigh = BinaryOperator .New( debugInfo, BinaryOperator.ALU.SHR, true, false, (VariableExpression)resFragments[1], src1Fragments[1], ts.CreateConstant( (int)31 ) );
}
else
{
//
// Assign high part of Left to low part of Res, clear high part of Res.
//
opLow = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resFragments[0], src1Fragments[1] );
opHigh = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resFragments[1], ts.CreateConstant( (int)0 ) );
}
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
op.AddOperatorBefore ( opLow );
op.SubstituteWithOperator( opHigh, Operator.SubstitutionFlags.Default );
}
else
{
//
// These should have been removed by a previous phase.
//
throw TypeConsistencyErrorException.Create( "Unexpected operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
op.Delete();
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(AbstractUnaryOperator) )]
private static void Handle_UnaryOperator( PhaseExecution.NotificationContext nc )
{
var op = (AbstractUnaryOperator)nc.CurrentOperator;
var ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc = op.FirstArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
TypeRepresentation tdSrc = exSrc.Type;
uint sizeSrc = tdSrc.SizeOfHoldingVariableInWords;
bool fSigned = op.Signed;
var alu = op.Alu;
if(tdSrc.IsFloatingPoint)
{
if(op is UnaryOperator)
{
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
CHECKS.ASSERT( resFragments.Length == 1, "Expecting result in a single floating point register: {0}" , op );
CHECKS.ASSERT( srcFragments.Length == 1, "Expecting left argument in a single floating point register: {0}" , op );
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
UnaryOperator opNew = UnaryOperator.New( debugInfo, alu, fSigned, false, newRes, newSrc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(tdSrc.IsNumeric == false || tdSrc.IsInteger)
{
if(sizeSrc == 1)
{
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
AbstractUnaryOperator opNew;
if (op is UnaryOperator ) { opNew = UnaryOperator .New( debugInfo, alu, fSigned, false, newRes, newSrc ); }
else if(op is UnaryOperatorWithCarryOut) { opNew = UnaryOperatorWithCarryOut.New( debugInfo, alu, fSigned, false, newRes, op.SecondResult, newSrc ); }
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(sizeSrc == 2)
{
switch(alu)
{
case UnaryOperator.ALU.NEG:
if(op is UnaryOperator)
{
ConditionCodeExpression cc = cfg.AllocateConditionCode();
var opLow = BinaryOperatorWithCarryOut.New( debugInfo, BinaryOperator.ALU.SUB, fSigned, false, (VariableExpression)resFragments[0], cc, ts.CreateConstant( (int)0 ), srcFragments[0] );
op.AddOperatorBefore( opLow );
var opHigh = BinaryOperatorWithCarryIn.New( debugInfo, BinaryOperator.ALU.SUB, fSigned, false, (VariableExpression)resFragments[1], ts.CreateConstant( (int)0 ), srcFragments[1], cc );
op.AddOperatorBefore( opHigh );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
break;
case UnaryOperator.ALU.NOT:
if(op is UnaryOperator)
{
UnaryOperator opLow = UnaryOperator.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[0], srcFragments[0] );
op.AddOperatorBefore( opLow );
UnaryOperator opHigh = UnaryOperator.New( debugInfo, alu, fSigned, false, (VariableExpression)resFragments[1], srcFragments[1] );
op.AddOperatorBefore( opHigh );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
op.Delete();
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(ConvertOperator) )]
private static void Handle_ConvertOperator( PhaseExecution.NotificationContext nc )
{
ConvertOperator op = (ConvertOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc = op.FirstArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
CHECKS.ASSERT( resFragments.Length == 1, "Expecting result of conversion to fit in one register: {0}" , op );
CHECKS.ASSERT( srcFragments.Length == 1, "Expecting argument of conversion to fit in one register: {0}", op );
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
ConvertOperator opNew = ConvertOperator.New( debugInfo, op.InputKind, op.OutputKind, op.CheckOverflow, newRes, newSrc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(SignExtendOperator) )]
private static void Handle_SignExtendOperator( PhaseExecution.NotificationContext nc )
{
SignExtendOperator op = (SignExtendOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc = op.FirstArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
uint sizeRes = exRes.Type.SizeOfHoldingVariableInWords;
uint sizeSrc = exSrc.Type.SizeOfHoldingVariableInWords;
if(sizeRes == 1 && sizeSrc == 1)
{
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
SignExtendOperator opNew = SignExtendOperator.New( debugInfo, op.SignificantSize, false, newRes, newSrc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
else if(sizeRes == 2 && sizeSrc == 1)
{
VariableExpression newResLo = (VariableExpression)resFragments[0];
VariableExpression newResHi = (VariableExpression)resFragments[1];
Expression newSrc = srcFragments[0];
if(op.SignificantSize < 4)
{
op.AddOperatorBefore( SignExtendOperator.New( debugInfo, op.SignificantSize, false, newResLo, newSrc ) );
}
else
{
op.AddOperatorBefore( SingleAssignmentOperator.New( debugInfo, newResLo, newSrc ) );
}
//
// Copy the sign bit through the high word.
//
BinaryOperator opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHR, true, false, newResHi, newResLo, ts.CreateConstant( 31 ) );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for sign extension: {0}", op );
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(ZeroExtendOperator) )]
private static void Handle_ZeroExtendOperator( PhaseExecution.NotificationContext nc )
{
ZeroExtendOperator op = (ZeroExtendOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc = op.FirstArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
uint sizeRes = exRes.Type.SizeOfHoldingVariableInWords;
uint sizeSrc = exSrc.Type.SizeOfHoldingVariableInWords;
if(sizeRes == 1 && sizeSrc == 1)
{
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
ZeroExtendOperator opNew = ZeroExtendOperator.New( debugInfo, op.SignificantSize, false, newRes, newSrc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(sizeRes == 2 && sizeSrc == 1)
{
VariableExpression newResLo = (VariableExpression)resFragments[0];
VariableExpression newResHi = (VariableExpression)resFragments[1];
Expression newSrc = srcFragments[0];
if(op.SignificantSize < 4)
{
op.AddOperatorBefore( ZeroExtendOperator.New( debugInfo, op.SignificantSize, false, newResLo, newSrc ) );
}
else
{
op.AddOperatorBefore( SingleAssignmentOperator.New( debugInfo, newResLo, newSrc ) );
}
//
// Clear high word.
//
var opNew = SingleAssignmentOperator.New( debugInfo, newResHi, ts.CreateConstant( newResHi.Type, 0 ) );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for sign extension: {0}", op );
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(TruncateOperator) )]
private static void Handle_TruncateOperator( PhaseExecution.NotificationContext nc )
{
TruncateOperator op = (TruncateOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression exRes = op.FirstResult;
Expression exSrc = op.FirstArgument;
Expression[] resFragments = cfg.GetFragmentsForExpression( exRes );
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
uint sizeRes = exRes.Type.SizeOfHoldingVariableInWords;
uint sizeSrc = exSrc.Type.SizeOfHoldingVariableInWords;
if(sizeRes == 1 && sizeSrc == 1)
{
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrc = srcFragments[0];
TruncateOperator opNew = TruncateOperator.New( debugInfo, op.SignificantSize, false, newRes, newSrc );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else if(sizeRes == 1 && sizeSrc == 2)
{
VariableExpression newRes = (VariableExpression)resFragments[0];
Expression newSrcLo = srcFragments[0];
Expression newSrcHi = srcFragments[1];
Operator opNew;
if(op.SignificantSize < 4)
{
opNew = TruncateOperator.New( debugInfo, op.SignificantSize, false, newRes, newSrcLo );
}
else if(op.SignificantSize == 4)
{
opNew = SingleAssignmentOperator.New( debugInfo, newRes, newSrcLo );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for truncation: {0}", op );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for truncation: {0}", op );
}
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(LoadIndirectOperator) )]
private static void Handle_LoadIndirectOperator( PhaseExecution.NotificationContext nc )
{
LoadIndirectOperator op = (LoadIndirectOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.FirstArgument;
VariableExpression exDst = op.FirstResult;
TypeRepresentation tdLoad = op.Type;
FieldRepresentation[] accessPath = op.AccessPath;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
Expression[] dstFragments = cfg.GetFragmentsForExpression( exDst );
int sizeDst = dstFragments.Length;
bool fIsVolatile = op.MayMutateExistingStorage;
for(int offset = 0; offset < sizeDst; offset++)
{
VariableExpression exDstFragment = (VariableExpression)dstFragments[offset];
Expression exSrcFragment = srcFragments[ 0];
TypeRepresentation tdDstFragment = exDstFragment.Type;
TypeRepresentation td;
if(sizeDst > 1)
{
td = tdDstFragment;
}
else if(tdDstFragment == tdLoad)
{
td = tdDstFragment;
}
else if(tdDstFragment.SizeOfHoldingVariable <= tdLoad.SizeOfHoldingVariable)
{
td = tdDstFragment;
}
else
{
td = tdLoad;
}
var fd = tdLoad.FindFieldAtOffset( offset * sizeof(uint) );
FieldRepresentation[] newAccessPath;
if(fd != null && fd.FieldType == td)
{
newAccessPath = ArrayUtility.AppendToArray( accessPath, fd );
}
else
{
newAccessPath = accessPath;
}
LoadIndirectOperator opNew = LoadIndirectOperator.New( debugInfo, td, exDstFragment, exSrcFragment, newAccessPath, op.Offset + offset * sizeof(uint), fIsVolatile, false );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(StoreIndirectOperator) )]
private static void Handle_StoreIndirectOperator( PhaseExecution.NotificationContext nc )
{
StoreIndirectOperator op = (StoreIndirectOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.SecondArgument;
Expression exDst = op.FirstArgument;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
Expression[] dstFragments = cfg.GetFragmentsForExpression( exDst );
int sizeSrc = srcFragments.Length;
for(int offset = 0; offset < sizeSrc; offset++)
{
Expression exSrcFragment = srcFragments[offset];
Expression exDstFragment = dstFragments[ 0];
TypeRepresentation td = sizeSrc > 1 ? exSrcFragment.Type : op.Type;
StoreIndirectOperator opNew = StoreIndirectOperator.New( debugInfo, td, exDstFragment, exSrcFragment, op.AccessPath, op.Offset + offset * sizeof(uint), false );
opNew.CopyAnnotations( op );
op.AddOperatorBefore( opNew );
}
op.Delete();
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(BinaryConditionalControlOperator) )]
private static void Handle_BinaryConditionalControlOperator( PhaseExecution.NotificationContext nc )
{
BinaryConditionalControlOperator op = (BinaryConditionalControlOperator)nc.CurrentOperator;
//--//
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.FirstArgument;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
TypeRepresentation tdSrc = exSrc.Type;
uint sizeSrc = tdSrc.SizeOfHoldingVariableInWords;
//--//
ConditionCodeExpression cc = cfg.AllocateConditionCode();
if(tdSrc.IsFloatingPoint)
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for compare: {0}", op );
}
else if(tdSrc.IsNumeric == false || tdSrc.IsInteger)
{
if(sizeSrc == 1)
{
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, srcFragments[0], ts.CreateConstant( 0 ) ) );
}
else if(sizeSrc == 2)
{
VariableExpression tmpFragment = cfg.AllocatePseudoRegister( srcFragments[0].Type );
var opLow = BinaryOperatorWithCarryOut.New( debugInfo, BinaryOperator.ALU.OR, false, false, tmpFragment, cc, srcFragments[0], srcFragments[1] );
op.AddOperatorBefore( opLow );
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for compare: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for compare: {0}", op );
}
ConditionCodeConditionalControlOperator opNew = ConditionCodeConditionalControlOperator.New( debugInfo, ConditionCodeExpression.Comparison.NotEqual, cc, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(MultiWayConditionalControlOperator) )]
private static void Handle_MultiWayConditionalControlOperator( PhaseExecution.NotificationContext nc )
{
MultiWayConditionalControlOperator op = (MultiWayConditionalControlOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exSrc = op.FirstArgument;
Expression[] srcFragments = cfg.GetFragmentsForExpression( exSrc );
uint sizeSrc = exSrc.Type.SizeOfHoldingVariableInWords;
//--//
if(sizeSrc == 1)
{
Expression newSrc = srcFragments[0];
MultiWayConditionalControlOperator opNew = MultiWayConditionalControlOperator.New( debugInfo, newSrc, op.TargetBranchNotTaken, op.Targets );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
else
{
throw TypeConsistencyErrorException.Create( "Multi-way branches only support 32bit inputs: {0}", op );
}
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(ReturnControlOperator) )]
private static void Handle_ReturnControlOperator( PhaseExecution.NotificationContext nc )
{
ReturnControlOperator op = (ReturnControlOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(ts.OperatorAlreadyInScalarForm( op ) == false)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
//
// No need to do anything special here.
// The code for mapping arguments to words also maps the return value to a set of fragments.
// As a consequence, the assignments to the return value are already directed to the right spot.
//
ReturnControlOperator opNew = ReturnControlOperator.New( cfg.GetFragmentsForExpression( cfg.ReturnValue ) );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ExpandAggregateTypes) )]
[CompilationSteps.OperatorHandler( typeof(CallOperator) )]
private static void Handle_CallOperator( PhaseExecution.NotificationContext nc )
{
CallOperator op = (CallOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Abstractions.CallingConvention cc = ts.CallingConvention;
Abstractions.CallingConvention.CallState callState = cc.CreateCallState( Abstractions.CallingConvention.Direction.Caller );
BasicBlock current = op.BasicBlock;
Debugging.DebugInfo debugInfo = op.DebugInfo;
VariableExpression returnValue = op.Results.Length == 1 ? op.FirstResult : null;
Expression[] resSrcFragments = cc.AssignReturnValue( cfg, op, returnValue, callState );
Expression[][] srcFragments = cfg.GetFragmentsForExpressionArray( op.Arguments );
int offset = op is IndirectCallOperator ? 1 : 0;
SingleAssignmentOperator opReg = null;
Expression[] rhs = Expression.SharedEmptyArray;
bool fIsImportedMethod = op is StaticCallOperator && 0 != ( ( (StaticCallOperator)op ).TargetMethod.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Imported );
for(int arg = 0; arg + offset < srcFragments.Length; arg++)
{
Expression[] argFragments = srcFragments[arg+offset];
Expression dst = op.Arguments[arg+offset];
///
/// For external calls, we do not want the first argument to be the 'this' pointer.
///
if(arg == 0 && fIsImportedMethod)
{
continue;
}
Expression[] dstFragments = cc.AssignArgument( cfg, op, dst, callState );
int requiredWords = argFragments.Length;
if(arg == 0 && op is StaticCallOperator)
{
//
// Don't bother loading the 'this' pointer for static methods.
//
continue;
}
for(int wordOffset = 0; wordOffset < requiredWords; wordOffset++)
{
Expression argEx = argFragments[wordOffset];
VariableExpression dstEx = (VariableExpression)dstFragments[wordOffset];
SingleAssignmentOperator opNew = SingleAssignmentOperator.New( debugInfo, dstEx, argEx );
if(fIsImportedMethod)
{
opNew.AddAnnotation( ExternalCallArgumentAnnotation.Create(ts) );
}
rhs = ArrayUtility.AppendToNotNullArray( rhs, (Expression)dstEx );
//
// Well, we want to assign first the values that get passed on the stack, then the ones that get passed in registers.
// The idea is that, if the result of a previous call is used for a stack value, we could pick it up directly from the volatile registers.
//
Operator opTarget = op;
if(dstEx is PhysicalRegisterExpression)
{
if(opReg == null)
{
opReg = opNew;
}
}
else if(opReg != null)
{
opTarget = opReg;
}
opTarget.AddOperatorBefore( opNew );
}
}
SubroutineOperator newCall;
if(op is IndirectCallOperator)
{
newCall = IndirectSubroutineOperator.New( debugInfo, op.TargetMethod, srcFragments[0][0], rhs );
}
else
{
newCall = DirectSubroutineOperator.New( debugInfo, op.TargetMethod, rhs );
}
Annotation[] annotations = op.Annotations;
foreach(Annotation an in annotations)
{
if(an is NotNullAnnotation ||
an is FixedLengthArrayAnnotation )
{
}
else
{
newCall.AddAnnotation( an );
}
}
op.SubstituteWithOperator( newCall, Operator.SubstitutionFlags.Default );
if(resSrcFragments != null)
{
Expression[] resDstFragments = cfg.GetFragmentsForExpression( returnValue );
for(int wordOffset = 0; wordOffset < resDstFragments.Length; wordOffset++)
{
var opNew = SingleAssignmentOperator.New( debugInfo, (VariableExpression)resDstFragments[wordOffset], resSrcFragments[wordOffset] );
foreach(Annotation an in annotations)
{
if(an is NotNullAnnotation ||
an is FixedLengthArrayAnnotation )
{
opNew.AddAnnotation( an );
}
}
newCall.AddOperatorAfter( opNew );
}
}
if(newCall.GetNextOperator() is DeadControlOperator)
{
//
// No need to add side effects after a dead call.
//
}
else
{
foreach(VariableExpression exToInvalidate in cc.CollectExpressionsToInvalidate( cfg, op, resSrcFragments ))
{
newCall.AddAnnotation( PostInvalidationAnnotation.Create( ts, exToInvalidate ) );
}
}
nc.MarkAsModified();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_FromImplicitToExplicitExceptions.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define ENABLE_OVERFLOW_CHECKS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_FromImplicitToExplicitExceptions
{
#if ENABLE_OVERFLOW_CHECKS
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(BinaryOperator) )]
#endif // ENABLE_OVERFLOW_CHECKS
private static void Handle_BinaryOperator( PhaseExecution.NotificationContext nc )
{
BinaryOperator op = (BinaryOperator)nc.CurrentOperator;
if(op.CheckOverflow)
{
var overflowFlag = CreateOverflowCheck(nc, op);
var opNew = BinaryOperatorWithCarryOut.New(
op.DebugInfo,
op.Alu,
op.Signed,
false,
op.FirstResult,
overflowFlag,
op.FirstArgument,
op.SecondArgument);
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
#if ENABLE_OVERFLOW_CHECKS
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(UnaryOperator) )]
#endif // ENABLE_OVERFLOW_CHECKS
private static void Handle_UnaryOperator( PhaseExecution.NotificationContext nc )
{
UnaryOperator op = (UnaryOperator)nc.CurrentOperator;
if(op.CheckOverflow)
{
var overflowFlag = CreateOverflowCheck(nc, op);
var opNew = UnaryOperatorWithCarryOut.New(
op.DebugInfo,
op.Alu,
op.Signed,
false,
op.FirstResult,
overflowFlag,
op.FirstArgument);
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(SignExtendOperator) )]
private static void Handle_SignExtendOperator( PhaseExecution.NotificationContext nc )
{
SignExtendOperator op = (SignExtendOperator)nc.CurrentOperator;
VariableExpression lhs = op.FirstResult;
Expression rhs = op.FirstArgument;
var di = op.DebugInfo;
if(lhs.Type.Size == rhs.Type.Size && lhs.Type.Size == op.SignificantSize)
{
var opNew = SingleAssignmentOperator.New( di, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
else if(op.CheckOverflow)
{
var opNew = SignExtendOperator.New( di, op.SignificantSize, false, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
VerifyNoLossOfPrecision( nc, opNew, lhs, rhs );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(ZeroExtendOperator) )]
private static void Handle_ZeroExtendOperator( PhaseExecution.NotificationContext nc )
{
ZeroExtendOperator op = (ZeroExtendOperator)nc.CurrentOperator;
VariableExpression lhs = op.FirstResult;
Expression rhs = op.FirstArgument;
if(lhs.Type.Size == rhs.Type.Size && lhs.Type.Size == op.SignificantSize)
{
var opNew = SingleAssignmentOperator.New( op.DebugInfo, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
else if(op.CheckOverflow)
{
var opNew = ZeroExtendOperator.New( op.DebugInfo, op.SignificantSize, false, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
VerifyNoLossOfPrecision( nc, opNew, lhs, rhs );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(TruncateOperator) )]
private static void Handle_TruncateOperator( PhaseExecution.NotificationContext nc )
{
TruncateOperator op = (TruncateOperator)nc.CurrentOperator;
VariableExpression lhs = op.FirstResult;
Expression rhs = op.FirstArgument;
if(lhs.Type.Size == rhs.Type.Size && lhs.Type.Size == op.SignificantSize)
{
var opNew = SingleAssignmentOperator.New( op.DebugInfo, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
else if(op.CheckOverflow)
{
TruncateOperator opNew = TruncateOperator.New( op.DebugInfo, op.SignificantSize, false, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
VerifyNoLossOfPrecision( nc, opNew, lhs, rhs );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(NullCheckOperator) )]
private static void Handle_NullCheckOperator( PhaseExecution.NotificationContext nc )
{
Operator op = nc.CurrentOperator;
CompilationConstraints[] ccArray = nc.CurrentCFG.CompilationConstraintsAtOperator( op );
Expression addr = op.FirstArgument;
if(addr == nc.CurrentCFG.Arguments[0])
{
// We know the 'this' pointer is non-null since the caller will check before calling.
op.Delete();
}
else if(addr.Type is ManagedPointerTypeRepresentation ||
addr.Type is UnmanagedPointerTypeRepresentation)
{
// Managed pointers are guaranteed non-null by construction, while unmanaged pointers
// can only be used in an unsafe context and therefore should never be checked.
op.Delete();
}
else if(ControlFlowGraphState.HasCompilationConstraint( ccArray, CompilationConstraints.NullChecks_OFF ) ||
ControlFlowGraphState.HasCompilationConstraint( ccArray, CompilationConstraints.NullChecks_OFF_DEEP ) )
{
op.Delete();
}
else
{
Debugging.DebugInfo debugInfo = op.DebugInfo;
BasicBlock current = op.BasicBlock;
BasicBlock continueBB;
BasicBlock throwBB;
SplitAndCall( nc, op, true, nc.TypeSystem.WellKnownMethods.ThreadImpl_ThrowNullException, out continueBB, out throwBB );
//--//
current.AddOperator( BinaryConditionalControlOperator.New( debugInfo, addr, throwBB, continueBB ) );
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(OutOfBoundCheckOperator) )]
private static void Handle_OutOfBoundCheckOperator( PhaseExecution.NotificationContext nc )
{
Operator op = nc.CurrentOperator;
CompilationConstraints[] ccArray = nc.CurrentCFG.CompilationConstraintsAtOperator( op );
if(ControlFlowGraphState.HasCompilationConstraint( ccArray, CompilationConstraints.BoundsChecks_OFF ) ||
ControlFlowGraphState.HasCompilationConstraint( ccArray, CompilationConstraints.BoundsChecks_OFF_DEEP ) )
{
op.Delete();
}
else
{
TypeSystemForCodeTransformation ts = nc.TypeSystem;
WellKnownTypes wkt = ts.WellKnownTypes;
WellKnownFields wkf = ts.WellKnownFields;
WellKnownMethods wkm = ts.WellKnownMethods;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exAddress = op.FirstArgument;
Expression exIndex = op.SecondArgument;
BasicBlock currentBB = op.BasicBlock;
BasicBlock continueBB;
BasicBlock throwBB;
SplitAndCall( nc, op, true, wkm.ThreadImpl_ThrowIndexOutOfRangeException, out continueBB, out throwBB );
//--//
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TemporaryVariableExpression exLength = cfg.AllocateTemporary( wkt.System_UInt32, null );
currentBB.AddOperator( LoadInstanceFieldOperator .New( debugInfo, wkf.ArrayImpl_m_numElements, exLength, exAddress, false ) );
currentBB.AddOperator( CompareConditionalControlOperator.New( debugInfo, CompareAndSetOperator.ActionCondition.LT, false, exIndex, exLength, throwBB, continueBB ) );
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static VariableExpression CreateOverflowCheck(PhaseExecution.NotificationContext nc, Operator op)
{
TypeRepresentation boolType = nc.TypeSystem.WellKnownTypes.System_Boolean;
TemporaryVariableExpression overflowFlag = nc.CurrentCFG.AllocateTemporary(boolType, null);
BasicBlock continueBB;
BasicBlock throwBB;
MethodRepresentation throwOverflow = nc.TypeSystem.WellKnownMethods.ThreadImpl_ThrowOverflowException;
SplitAndCall(nc, op, true, throwOverflow, out continueBB, out throwBB);
op.AddOperatorAfter(BinaryConditionalControlOperator.New(op.DebugInfo, overflowFlag, continueBB, throwBB));
nc.MarkAsModified();
return overflowFlag;
}
private static void SplitAndCall( PhaseExecution.NotificationContext nc ,
Operator op ,
bool fRemoveOperator ,
MethodRepresentation md ,
out BasicBlock continueBB ,
out BasicBlock throwBB )
{
Debugging.DebugInfo debugInfo = op.DebugInfo;
BasicBlock current = op.BasicBlock;
BasicBlock[] basicBlocks = nc.CurrentCFG.DataFlow_SpanningTree_BasicBlocks;
throwBB = null;
// Try to find an existing throw block for the same exception.
foreach(BasicBlock block in basicBlocks)
{
var callOp = block.FirstOperator as StaticCallOperator;
if( (callOp != null) &&
(callOp.TargetMethod == md) &&
ArrayUtility.ArrayEqualsNotNull( block.ProtectedBy, current.ProtectedBy, 0 ))
{
throwBB = block;
break;
}
}
continueBB = current.SplitAtOperator( op, fRemoveOperator, false );
// We didn't find an existing throw block, so create a new one.
if(throwBB == null)
{
Expression[] rhs = nc.TypeSystem.AddTypePointerToArgumentsOfStaticMethod( md );
throwBB = NormalBasicBlock.CreateWithSameProtection( current );
throwBB.AddOperator( StaticCallOperator .New( debugInfo, CallOperator.CallKind.Direct, md, rhs ) );
throwBB.AddOperator( DeadControlOperator.New( debugInfo ) );
}
nc.MarkAsModified();
}
private static void VerifyNoLossOfPrecision( PhaseExecution.NotificationContext nc ,
Operator op ,
VariableExpression lhs ,
Expression rhs )
{
var cfg = nc.CurrentCFG;
var lhsExt = cfg.AllocateTemporary( rhs.Type, null );
Operator opNew;
if(lhs.Type.IsSigned)
{
opNew = SignExtendOperator.New( op.DebugInfo, lhs.Type.Size, false, lhsExt, lhs );
}
else
{
opNew = ZeroExtendOperator.New( op.DebugInfo, lhs.Type.Size, false, lhsExt, lhs );
}
op.AddOperatorAfter( opNew );
//--//
BasicBlock continueBB;
BasicBlock throwBB;
SplitAndCall( nc, opNew.GetNextOperator(), false, nc.TypeSystem.WellKnownMethods.ThreadImpl_ThrowOverflowException, out continueBB, out throwBB );
//--//
opNew.BasicBlock.AddOperator( CompareConditionalControlOperator.New( op.DebugInfo, CompareAndSetOperator.ActionCondition.NE, false, lhsExt, rhs, continueBB, throwBB ) );
nc.MarkAsModified();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_HighLevel.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_HighLevel
{
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(ObjectAllocationOperator) )]
private static void Handle_ObjectAllocationOperator( PhaseExecution.NotificationContext nc )
{
ObjectAllocationOperator op = (ObjectAllocationOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
WellKnownMethods wkm = ts.WellKnownMethods;
MethodRepresentation mdAllocateObject = wkm.TypeSystemManager_AllocateObject;
MethodRepresentation md = op.Method;
TypeRepresentation td = op.Type;
CallOperator call;
Expression[] rhs;
Expression exStringLen = null;
//
// Is this a special object?
//
for(var td2 = td; td2 != null; td2 = td2.Extends)
{
if(ts.GarbageCollectionExtensions.ContainsKey( td2 ))
{
mdAllocateObject = wkm.TypeSystemManager_AllocateObjectWithExtensions;
break;
}
}
if(md != null)
{
if(md == wkm.StringImpl_ctor_char_int)
{
exStringLen = op.SecondArgument;
}
else if(md == wkm.StringImpl_ctor_charArray)
{
TemporaryVariableExpression tmp = nc.CurrentCFG.AllocateTemporary( ts.WellKnownTypes.System_Int32, null );
op.AddOperatorBefore( ArrayLengthOperator.New( op.DebugInfo, tmp, op.FirstArgument ) );
exStringLen = tmp;
}
else if(md == wkm.StringImpl_ctor_charArray_int_int)
{
exStringLen = op.ThirdArgument;
}
}
//
// Special case to allocate strings built out of characters.
//
if(exStringLen != null)
{
if(ts.IsReferenceCountingType( ts.WellKnownTypes.System_String ) &&
!ts.ShouldExcludeMethodFromReferenceCounting( nc.CurrentMethod ))
{
mdAllocateObject = wkm.StringImpl_FastAllocateReferenceCountingString;
}
else
{
mdAllocateObject = wkm.StringImpl_FastAllocateString;
}
rhs = ts.AddTypePointerToArgumentsOfStaticMethod( mdAllocateObject, exStringLen );
call = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, mdAllocateObject, op.Results, rhs );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.CopyAnnotations );
call.AddAnnotation( NotNullAnnotation.Create( ts ) );
}
else
{
if( ts.IsReferenceCountingGarbageCollectionEnabled &&
md != wkm.TypeSystemManager_AllocateObjectWithExtensions &&
ts.IsReferenceCountingType( td ) &&
!ts.ShouldExcludeMethodFromReferenceCounting( nc.CurrentMethod ))
{
mdAllocateObject = wkm.TypeSystemManager_AllocateReferenceCountingObject;
}
TemporaryVariableExpression typeSystemManagerEx = FetchTypeSystemManager( nc, op );
rhs = new Expression[] { typeSystemManagerEx, ts.GetVTable( op.Type ) };
call = InstanceCallOperator.New( op.DebugInfo, CallOperator.CallKind.Virtual, mdAllocateObject, op.Results, rhs, true );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.CopyAnnotations );
call.AddAnnotation( NotNullAnnotation.Create( ts ) );
var mdFinalizer = td.FindDestructor();
if(mdFinalizer != null && mdFinalizer.OwnerType != ts.WellKnownTypes.System_Object)
{
var mdHelper = wkm.Finalizer_Allocate;
var rhsHelper = ts.AddTypePointerToArgumentsOfStaticMethod( mdHelper, call.FirstResult );
var callHelper = StaticCallOperator.New( call.DebugInfo, CallOperator.CallKind.Direct, mdHelper, rhsHelper );
call.AddOperatorAfter( callHelper );
}
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(ArrayAllocationOperator) )]
private static void Handle_ArrayAllocationOperator( PhaseExecution.NotificationContext nc )
{
ArrayAllocationOperator op = (ArrayAllocationOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
TemporaryVariableExpression typeSystemManagerEx = FetchTypeSystemManager( nc, op );
MethodRepresentation mdAllocateArray = ts.WellKnownMethods.TypeSystemManager_AllocateArray;
CallOperator call;
Expression[] rhs;
Expression exLen = op.FirstArgument;
if( ts.IsReferenceCountingGarbageCollectionEnabled &&
ts.IsReferenceCountingType( ts.WellKnownTypes.System_Array ) &&
!ts.ShouldExcludeMethodFromReferenceCounting( nc.CurrentMethod ))
{
mdAllocateArray = ts.WellKnownMethods.TypeSystemManager_AllocateReferenceCountingArray;
}
rhs = new Expression[] { typeSystemManagerEx, ts.GetVTable( op.Type ), exLen };
call = InstanceCallOperator.New( op.DebugInfo, CallOperator.CallKind.Virtual, mdAllocateArray, op.Results, rhs, true );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.CopyAnnotations );
call.AddAnnotation( NotNullAnnotation.Create( ts ) );
ConstantExpression exLenConst = exLen as ConstantExpression;
if(exLenConst != null && exLenConst.IsValueInteger)
{
ulong val; exLenConst.GetAsRawUlong( out val );
call.AddAnnotation( FixedLengthArrayAnnotation.Create( ts, (int)val ) );
}
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(ArrayLengthOperator) )]
private static void Handle_ArrayLengthOperator( PhaseExecution.NotificationContext nc )
{
ArrayLengthOperator op = (ArrayLengthOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
InstanceCallOperator opNew = InstanceCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, typeSystem.WellKnownMethods.ArrayImpl_get_Length, op.Results, new Expression[] { op.FirstArgument }, true );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(ThrowControlOperator) )]
private static void Handle_ThrowControlOperator( PhaseExecution.NotificationContext nc )
{
ThrowControlOperator op = (ThrowControlOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
TemporaryVariableExpression typeSystemManagerEx = FetchTypeSystemManager( nc, op );
MethodRepresentation mdThrow = typeSystem.WellKnownMethods.TypeSystemManager_Throw;
Debugging.DebugInfo debugInfo = op.DebugInfo;
CallOperator call;
Expression[] rhs;
rhs = new Expression[] { typeSystemManagerEx, op.FirstArgument };
call = InstanceCallOperator.New( debugInfo, CallOperator.CallKind.Virtual, mdThrow, rhs, true );
call.CopyAnnotations( op );
op.AddOperatorBefore( call );
op.SubstituteWithOperator( DeadControlOperator.New( debugInfo ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(RethrowControlOperator) )]
private static void Handle_RethrowControlOperator( PhaseExecution.NotificationContext nc )
{
RethrowControlOperator op = (RethrowControlOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
TemporaryVariableExpression typeSystemManagerEx = FetchTypeSystemManager( nc, op );
MethodRepresentation mdRethrow = typeSystem.WellKnownMethods.TypeSystemManager_Rethrow;
Debugging.DebugInfo debugInfo = op.DebugInfo;
CallOperator call;
Expression[] rhs;
rhs = new Expression[] { typeSystemManagerEx };
call = InstanceCallOperator.New( debugInfo, CallOperator.CallKind.Virtual, mdRethrow, rhs, true );
call.CopyAnnotations( op );
op.AddOperatorBefore( call );
op.SubstituteWithOperator( DeadControlOperator.New( debugInfo ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(FetchExceptionOperator) )]
private static void Handle_FetchExceptionOperator( PhaseExecution.NotificationContext nc )
{
FetchExceptionOperator op = (FetchExceptionOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
MethodRepresentation md = typeSystem.WellKnownMethods.ThreadImpl_GetCurrentException;
CallOperator call;
Expression[] rhs;
rhs = typeSystem.AddTypePointerToArgumentsOfStaticMethod( md );
call = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, op.Results, rhs );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(CastOperator) )]
private static void Handle_CastOperator( PhaseExecution.NotificationContext nc )
{
WellKnownMethods wkm = nc.TypeSystem.WellKnownMethods;
CastOperator op = (CastOperator)nc.CurrentOperator;
Handle_GenericCastOperator( nc, op.Type, wkm.TypeSystemManager_CastToSealedType, wkm.TypeSystemManager_CastToType, wkm.TypeSystemManager_CastToInterface );
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(IsInstanceOperator) )]
private static void Handle_IsInstanceOperator( PhaseExecution.NotificationContext nc )
{
WellKnownMethods wkm = nc.TypeSystem.WellKnownMethods;
IsInstanceOperator op = (IsInstanceOperator)nc.CurrentOperator;
Handle_GenericCastOperator( nc, op.Type, wkm.TypeSystemManager_CastToSealedTypeNoThrow, wkm.TypeSystemManager_CastToTypeNoThrow, wkm.TypeSystemManager_CastToInterfaceNoThrow );
}
private static void Handle_GenericCastOperator( PhaseExecution.NotificationContext nc ,
TypeRepresentation target ,
MethodRepresentation mdSealedType ,
MethodRepresentation mdType ,
MethodRepresentation mdInterface )
{
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
Operator op = nc.CurrentOperator;
Expression src = op.FirstArgument;
if(target.CanBeAssignedFrom( src.Type, null ))
{
var opNew = SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, src );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
}
else
{
MethodRepresentation md;
Expression[] rhs;
CallOperator call;
if(target is InterfaceTypeRepresentation)
{
md = mdInterface;
}
else if(target is ArrayReferenceTypeRepresentation)
{
md = mdType;
}
else
{
TypeRepresentation targetSealed;
if(typeSystem.IsSealedType( target, out targetSealed ))
{
target = targetSealed;
md = mdSealedType;
}
else
{
md = mdType;
}
}
rhs = typeSystem.AddTypePointerToArgumentsOfStaticMethod( md, src, typeSystem.GetVTable( target ) );
call = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, op.Results, rhs );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.Default );
}
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(LoadStaticFieldAddressOperator) )]
private static void Handle_LoadStaticFieldAddressOperator( PhaseExecution.NotificationContext nc )
{
LoadStaticFieldAddressOperator op = (LoadStaticFieldAddressOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
Expression exRoot = ts.GenerateRootAccessor( op );
InstanceFieldRepresentation fd = ts.AddStaticFieldToGlobalRoot( (StaticFieldRepresentation)op.Field );
//
// 'exRoot' will never be null, so we don't need to add null checks.
//
LoadInstanceFieldAddressOperator opNew = LoadInstanceFieldAddressOperator.New( op.DebugInfo, fd, op.FirstResult, exRoot, false );
opNew.AddAnnotation( NotNullAnnotation.Create( ts ) );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(LoadStaticFieldOperator) )]
private static void Handle_LoadStaticFieldOperator( PhaseExecution.NotificationContext nc )
{
LoadStaticFieldOperator op = (LoadStaticFieldOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
Expression exRoot = typeSystem.GenerateRootAccessor( op );
InstanceFieldRepresentation fd = typeSystem.AddStaticFieldToGlobalRoot( (StaticFieldRepresentation)op.Field );
//
// 'exRoot' will never be null, so we don't need to check for it.
//
LoadInstanceFieldOperator opNew = LoadInstanceFieldOperator.New( op.DebugInfo, fd, op.FirstResult, exRoot, false );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(StoreStaticFieldOperator) )]
private static void Handle_StoreStaticFieldOperator( PhaseExecution.NotificationContext nc )
{
StoreStaticFieldOperator op = (StoreStaticFieldOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
Expression exRoot = typeSystem.GenerateRootAccessor( op );
InstanceFieldRepresentation fd = typeSystem.AddStaticFieldToGlobalRoot( (StaticFieldRepresentation)op.Field );
//
// 'exRoot' will never be null, so we don't need to check for it.
//
StoreInstanceFieldOperator opNew = StoreInstanceFieldOperator.New( op.DebugInfo, fd, exRoot, op.FirstArgument, false );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(MkRefAnyOperator) )]
private static void Handle_MkRefAnyOperator( PhaseExecution.NotificationContext nc )
{
MkRefAnyOperator op = (MkRefAnyOperator)nc.CurrentOperator;
VariableExpression lhs = op.FirstResult;
TypeRepresentation target = lhs.Type;
FieldRepresentation fdValue = target.FindField( "Value" );
FieldRepresentation fdType = target.FindField( "Type" );
op.AddOperatorBefore ( StoreInstanceFieldOperator.New( op.DebugInfo, fdValue, lhs, op.FirstArgument , true ) );
op.SubstituteWithOperator( StoreInstanceFieldOperator.New( op.DebugInfo, fdType , lhs, nc.TypeSystem.GetVTable( op.Type ), true ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(RefAnyValOperator) )]
private static void Handle_RefAnyValOperator( PhaseExecution.NotificationContext nc )
{
RefAnyValOperator op = (RefAnyValOperator)nc.CurrentOperator;
TypeRepresentation target = op.FirstArgument.Type;
FieldRepresentation fdValue = target.FindField( "Value" );
//
// TODO: Check that target.Type and op.Type are the same.
//
LoadInstanceFieldOperator opNew = LoadInstanceFieldOperator.New( op.DebugInfo, fdValue, op.FirstResult, op.FirstArgument, true );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(RefAnyTypeOperator) )]
private static void Handle_RefAnyTypeOperator( PhaseExecution.NotificationContext nc )
{
RefAnyTypeOperator op = (RefAnyTypeOperator)nc.CurrentOperator;
TypeRepresentation target = op.FirstArgument.Type;
FieldRepresentation fdType = target.FindField( "Type" );
LoadInstanceFieldOperator opNew = LoadInstanceFieldOperator.New( op.DebugInfo, fdType, op.FirstResult, op.FirstArgument, true );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(BoxOperator) )]
private static void Handle_BoxOperator( PhaseExecution.NotificationContext nc )
{
BoxOperator op = (BoxOperator)nc.CurrentOperator;
var lhs = op.FirstResult;
//
// Try to detect the pattern of many methods in generic types:
//
// private int FindEntry( TKey key )
// {
// if(key == null)
// {
//
// 'null' is always a reference and if TKey is a value type, the compiler has to generate a boxing operation.
// But boxed values are also non-null, so we can delete the boxing and substitute a constant for the outcome of the compare.
//
{
var cfg = nc.CurrentCFG;
var use = cfg.FindSingleUse( lhs );
if(use != null)
{
bool fNullOnRight;
if(use.IsBinaryOperationAgainstZeroValue( out fNullOnRight ) == lhs)
{
if(use is CompareAndSetOperator)
{
var use2 = (CompareAndSetOperator)use;
bool fSubstitute = false;
int val = 0;
switch(use2.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ:
fSubstitute = true;
val = 0;
break;
case CompareAndSetOperator.ActionCondition.NE:
fSubstitute = true;
val = 1;
break;
}
if(fSubstitute)
{
op.Delete();
use2.SubstituteWithOperator( SingleAssignmentOperator.New( use2.DebugInfo, use2.FirstResult, cfg.TypeSystem.CreateConstant( val ) ), Operator.SubstitutionFlags.Default );
nc.StopScan();
return;
}
}
if(use is CompareConditionalControlOperator)
{
var use2 = (CompareConditionalControlOperator)use;
bool fSubstitute = false;
BasicBlock target = null;
switch(use2.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ:
fSubstitute = true;
target = use2.TargetBranchNotTaken;
break;
case CompareAndSetOperator.ActionCondition.NE:
fSubstitute = true;
target = use2.TargetBranchTaken;
break;
}
if(fSubstitute)
{
op.Delete();
use2.SubstituteWithOperator( UnconditionalControlOperator.New( use2.DebugInfo, target ), Operator.SubstitutionFlags.Default );
nc.StopScan();
return;
}
}
}
}
}
op.AddOperatorBefore(ObjectAllocationOperator.New(op.DebugInfo, op.Type.UnderlyingType, lhs));
// Store requires a boxed type, but this argument may have been retyped. Retype it if necessary.
VariableExpression boxedValue = lhs;
if (boxedValue.Type != op.Type)
{
boxedValue = nc.AllocateTemporary(op.Type);
op.AddOperatorBefore(SingleAssignmentOperator.New(op.DebugInfo, boxedValue, lhs));
}
var storeOp = StoreInstanceFieldOperator.New(op.DebugInfo, op.Type.Fields[0], boxedValue, op.FirstArgument, false);
op.SubstituteWithOperator(storeOp, Operator.SubstitutionFlags.Default);
nc.MarkAsModified();
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(UnboxOperator) )]
private static void Handle_UnboxOperator( PhaseExecution.NotificationContext nc )
{
UnboxOperator op = (UnboxOperator)nc.CurrentOperator;
// Load requires a boxed type, but this argument may have been retyped. Retype it if necessary.
Expression boxedValue = op.FirstArgument;
if (boxedValue.Type != op.Type)
{
VariableExpression newValue = nc.AllocateTemporary(op.Type);
op.AddOperatorBefore(SingleAssignmentOperator.New(op.DebugInfo, newValue, op.FirstArgument));
boxedValue = newValue;
}
var loadOp = LoadInstanceFieldAddressOperator.New(
op.DebugInfo,
op.Type.Fields[0],
op.FirstResult,
boxedValue,
fNullCheck: true);
op.SubstituteWithOperator(loadOp, Operator.SubstitutionFlags.Default);
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.OperatorHandler( typeof(BinaryOperator) )]
private static void Handle_RemoveTypeConversions( PhaseExecution.NotificationContext nc )
{
BinaryOperator op = (BinaryOperator)nc.CurrentOperator;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
VariableExpression exLhs = op.FirstResult;
ConstantExpression exConstLeft = op.FirstArgument as ConstantExpression;
ConstantExpression exConstRight = op.SecondArgument as ConstantExpression;
ConversionOperator use = IsArgumentAsTypeConversion( cfg, exLhs , false );
ConversionOperator defLeft = IsArgumentAsTypeConversion( cfg, op.FirstArgument , true );
ConversionOperator defRight = IsArgumentAsTypeConversion( cfg, op.SecondArgument, true );
if(defLeft != null && defRight != null)
{
Expression leftPre = defLeft .FirstArgument;
Expression leftPost = defLeft .FirstResult;
Expression rightPre = defRight.FirstArgument;
Expression rightPost = defRight.FirstResult;
uint leftPreSize = leftPre .Type.UnderlyingType.Size;
uint leftPostSize = leftPost .Type.UnderlyingType.Size;
uint rightPreSize = rightPre .Type.UnderlyingType.Size;
uint rightPostSize = rightPost.Type.UnderlyingType.Size;
if(leftPreSize == leftPostSize && defLeft .SignificantSize == leftPostSize &&
rightPreSize == rightPostSize && defRight.SignificantSize == rightPostSize )
{
//
// The extend ops are no-ops, most likely due to the requirement of loading an int/long into the evaluation stack.
//
// Shortcut the binary operator to use the pre-extension values.
//
ShortcutBinaryOperation( nc, op, op.Signed, exLhs, leftPre, rightPre );
return;
}
if(leftPreSize == 4 && leftPostSize == 8 &&
rightPreSize == 4 && rightPostSize == 8 )
{
//
// This is a 32 -> 64 bit extension. Can we remove the 64 bit operation?
//
if(use != null && use.SignificantSize == 4)
{
//
// It's a 32->64->32 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD:
case BinaryOperator.ALU.SUB:
case BinaryOperator.ALU.MUL:
case BinaryOperator.ALU.AND:
case BinaryOperator.ALU.OR :
ShortcutBinaryOperation( nc, op, use.FirstResult.Type.IsSigned, use.FirstResult, leftPre, rightPre );
use.Delete();
nc.StopScan();
return;
}
}
}
else
{
//
// It's a 32x32->64 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL:
ShortcutBinaryOperation( nc, op, exLhs.Type.IsSigned, exLhs, leftPre, rightPre );
return;
}
}
}
}
}
if(defLeft != null && exConstRight != null)
{
Expression leftPre = defLeft.FirstArgument;
Expression leftPost = defLeft.FirstResult;
uint leftPreSize = leftPre .Type.UnderlyingType.Size;
uint leftPostSize = leftPost .Type.UnderlyingType.Size;
uint rightSize = exConstRight.Type.UnderlyingType.Size;
if(leftPreSize == leftPostSize && defLeft.SignificantSize == leftPostSize)
{
//
// The extend ops are no-ops, most likely due to the requirement of loading an int/long into the evaluation stack.
//
// Shortcut the binary operator to use the pre-extension values.
//
ShortcutBinaryOperation( nc, op, op.Signed, exLhs, leftPre, exConstRight );
return;
}
if(leftPreSize == 4 && leftPostSize == 8 && rightSize == 8)
{
ulong val;
if(exConstRight.GetAsRawUlong( out val ))
{
ConstantExpression exConstRightShort = nc.TypeSystem.CreateConstant( leftPre.Type, ConstantExpression.ConvertToType( leftPre.Type, val ) );
//
// This is a 32 -> 64 bit extension. Can we remove the 64 bit operation?
//
if(use != null && use.SignificantSize == 4)
{
//
// It's a 32->64->32 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD:
case BinaryOperator.ALU.SUB:
case BinaryOperator.ALU.MUL:
case BinaryOperator.ALU.AND:
case BinaryOperator.ALU.OR :
ShortcutBinaryOperation( nc, op, use.FirstResult.Type.IsSigned, use.FirstResult, leftPre, exConstRightShort );
use.Delete();
nc.StopScan();
return;
}
}
}
else
{
ulong valPost;
exConstRightShort.GetAsRawUlong( out valPost );
if(valPost == val)
{
//
// It's a 32x32->64 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL:
ShortcutBinaryOperation( nc, op, exLhs.Type.IsSigned, exLhs, leftPre, exConstRightShort );
return;
}
}
}
}
}
}
}
if(exConstLeft != null && defRight != null)
{
Expression rightPre = defRight.FirstArgument;
Expression rightPost = defRight.FirstResult;
uint rightPreSize = rightPre .Type.UnderlyingType.Size;
uint rightPostSize = rightPost .Type.UnderlyingType.Size;
uint leftSize = exConstLeft.Type.UnderlyingType.Size;
if(rightPreSize == rightPostSize && defRight.SignificantSize == rightPostSize)
{
//
// The extend ops are no-ops, most likely due to the requirement of loading an int/long into the evaluation stack.
//
// Shortcut the binary operator to use the pre-extension values.
//
ShortcutBinaryOperation( nc, op, op.Signed, exLhs, exConstLeft, rightPre );
return;
}
if(rightPreSize == 4 && rightPostSize == 8 && leftSize == 8)
{
ulong val;
if(exConstRight.GetAsRawUlong( out val ))
{
ConstantExpression exConstLeftShort = nc.TypeSystem.CreateConstant( rightPre.Type, ConstantExpression.ConvertToType( rightPre.Type, val ) );
//
// This is a 32 -> 64 bit extension. Can we remove the 64 bit operation?
//
if(use != null && use.SignificantSize == 4)
{
//
// It's a 32->64->32 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD:
case BinaryOperator.ALU.SUB:
case BinaryOperator.ALU.MUL:
case BinaryOperator.ALU.AND:
case BinaryOperator.ALU.OR :
ShortcutBinaryOperation( nc, op, use.FirstResult.Type.IsSigned, use.FirstResult, exConstLeftShort, rightPre );
use.Delete();
nc.StopScan();
return;
}
}
}
else
{
ulong valPost;
exConstLeftShort.GetAsRawUlong( out valPost );
if(valPost == val)
{
//
// It's a 32x32->64 sequence of operations.
//
if(op.CheckOverflow == false)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL:
ShortcutBinaryOperation( nc, op, exLhs.Type.IsSigned, exLhs, exConstLeftShort, rightPre );
return;
}
}
}
}
}
}
}
}
private static ConversionOperator IsArgumentAsTypeConversion( ControlFlowGraphStateForCodeTransformation cfg ,
Expression ex ,
bool fGetDefinition )
{
if(ex is VariableExpression)
{
Operator[][] useChains = cfg.DataFlow_UseChains;
Operator[][] defChains = cfg.DataFlow_DefinitionChains;
int idx = ex.SpanningTreeIndex;
Operator[] uses = useChains[idx];
Operator[] defs = defChains[idx];
if(uses.Length == 1 &&
defs.Length == 1 )
{
Operator res = fGetDefinition ? defs[0] : uses[0];
return res as ConversionOperator;
}
}
return null;
}
private static void ShortcutBinaryOperation( PhaseExecution.NotificationContext nc ,
BinaryOperator op ,
bool fSigned ,
VariableExpression lhs ,
Expression left ,
Expression right )
{
BinaryOperator opNew = BinaryOperator.New( op.DebugInfo, op.Alu, fSigned, op.CheckOverflow, lhs, left, right );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static TemporaryVariableExpression FetchTypeSystemManager( PhaseExecution.NotificationContext nc ,
Operator op )
{
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
MethodRepresentation mdTypeSystemManager = typeSystem.WellKnownMethods.TypeSystemManager_get_Instance;
TemporaryVariableExpression typeSystemManagerEx = nc.AllocateTemporary( mdTypeSystemManager.ReturnType );
CallOperator call;
Expression[] rhs;
rhs = typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdTypeSystemManager );
call = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, mdTypeSystemManager, VariableExpression.ToArray( typeSystemManagerEx ), rhs );
op.AddOperatorBefore( call );
nc.MarkAsModified();
return typeSystemManagerEx;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_HighLevelToMidLevel.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_HighLevelToMidLevel
{
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(LeaveControlOperator) )]
private static void Handle_LeaveControlOperator( PhaseExecution.NotificationContext nc )
{
LeaveControlOperator op = (LeaveControlOperator)nc.CurrentOperator;
UnconditionalControlOperator opNew = UnconditionalControlOperator.New( op.DebugInfo, op.TargetBranch );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static VariableExpression LoadVirtualMethodPointer(
PhaseExecution.NotificationContext nc,
InstanceCallOperator call,
Expression target,
MethodRepresentation method)
{
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
Debugging.DebugInfo debugInfo = call.DebugInfo;
TemporaryVariableExpression methodPointer;
if ( method.OwnerType is InterfaceTypeRepresentation )
{
// Load MethodPointers for interface.
MethodRepresentation mdVTableGetInterface = typeSystem.WellKnownMethods.VTable_GetInterface;
TemporaryVariableExpression methodPointers = nc.AllocateTemporary( mdVTableGetInterface.ReturnType );
Expression[] rhs = typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdVTableGetInterface, target, typeSystem.GetVTable( method.OwnerType ) );
CallOperator newCall = StaticCallOperator.New( debugInfo, CallOperator.CallKind.Direct, mdVTableGetInterface, VariableExpression.ToArray( methodPointers ), rhs );
call.AddOperatorBefore( newCall );
// Load the code pointer from the list. No null or range check, we know both will always pass.
int idx = method.FindInterfaceTableIndex();
methodPointer = nc.AllocateTemporary( methodPointers.Type.ContainedType );
call.AddOperatorBefore( LoadElementOperator.New( debugInfo, methodPointer, methodPointers, typeSystem.CreateConstant( idx ), null, false ) );
}
else
{
// Load the target object's VTable.
MethodRepresentation mdVTableGet = typeSystem.WellKnownMethods.VTable_Get;
TemporaryVariableExpression tmpVTable = nc.AllocateTemporary( mdVTableGet.OwnerType );
Expression[] rhs = typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdVTableGet, target );
CallOperator newCall = StaticCallOperator.New( debugInfo, CallOperator.CallKind.Direct, mdVTableGet, VariableExpression.ToArray( tmpVTable ), rhs );
call.AddOperatorBefore( newCall );
// Get method code pointers. The VTable can never be null here, so don't add null-checks.
FieldRepresentation fdMethodPointers = typeSystem.WellKnownFields.VTable_MethodPointers;
TemporaryVariableExpression methodPointers = nc.AllocateTemporary( fdMethodPointers.FieldType );
call.AddOperatorBefore( LoadInstanceFieldOperator.New( debugInfo, fdMethodPointers, methodPointers, tmpVTable, false ) );
// Load the code pointer from the list. No null or range check, we know both will always pass.
int index = method.FindVirtualTableIndex();
methodPointer = nc.AllocateTemporary( methodPointers.Type.ContainedType );
call.AddOperatorBefore( LoadElementOperator.New( debugInfo, methodPointer, methodPointers, typeSystem.CreateConstant( index ), null, false ) );
}
return methodPointer;
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(InstanceCallOperator) )]
private static void Handle_Convert_VirtualCallOperator( PhaseExecution.NotificationContext nc )
{
InstanceCallOperator op = (InstanceCallOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
if(op.CallType == CallOperator.CallKind.Virtual)
{
if(MethodTransformations.AttemptDevirtualization( typeSystem, op ))
{
nc.MarkAsModified();
return;
}
VariableExpression methodPointer = LoadVirtualMethodPointer( nc, op, op.FirstArgument, op.TargetMethod );
Expression[] rhs = ArrayUtility.InsertAtHeadOfNotNullArray( op.Arguments, methodPointer );
CallOperator call = IndirectCallOperator.New( op.DebugInfo, op.TargetMethod, op.Results, rhs, true, false );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(MethodRepresentationOperator) )]
private static void Handle_Convert_DelegateCreation( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
MethodRepresentationOperator op = (MethodRepresentationOperator)nc.CurrentOperator;
MethodRepresentation mdDelegate = op.Method;
VariableExpression mdPtr = op.FirstResult;
Operator def = cfg.FindSingleDefinition( mdPtr );
InstanceCallOperator call = cfg.FindSingleUse ( mdPtr ) as InstanceCallOperator;
if(def != null && call != null)
{
TypeSystemForCodeTransformation typeSystem = nc.TypeSystem;
WellKnownMethods wkm = typeSystem.WellKnownMethods;
Debugging.DebugInfo debugInfo = call.DebugInfo;
Expression dlg = call.FirstArgument;
Expression target = call.SecondArgument;
Expression exCode;
CallOperator newCall;
Expression[] rhs;
if(op.Arguments.Length == 0)
{
//
// Direct method.
//
CodePointer cp = typeSystem.CreateCodePointer( mdDelegate );
WellKnownTypes wkt = typeSystem.WellKnownTypes;
exCode = typeSystem.CreateConstant( wkt.Microsoft_Zelig_Runtime_TypeSystem_CodePointer, cp );
}
else
{
//
// Virtual method.
//
Expression source = op.FirstArgument;
if(source != target)
{
throw TypeConsistencyErrorException.Create( "Cannot create an instance delegate on '{0}' when the method comes from '{1}'", target, source );
}
exCode = LoadVirtualMethodPointer( nc, call, target, mdDelegate );
}
foreach( MethodRepresentation mdParent in call.TargetMethod.OwnerType.Extends.Methods )
{
if( mdParent is ConstructorMethodRepresentation )
{
rhs = new Expression[ ] { dlg, target, exCode };
newCall = InstanceCallOperator.New( debugInfo, CallOperator.CallKind.Direct, mdParent, call.Results, rhs, true );
call.SubstituteWithOperator( newCall, Operator.SubstitutionFlags.CopyAnnotations );
//
// Make sure we get rid of the LDFTN/LDVIRTFTN operators.
//
op.Delete( );
nc.StopScan( );
return;
}
}
}
throw TypeConsistencyErrorException.Create( "Unsupported delegate creation at {0}", op );
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(FieldOperator) )]
private static void Handle_FieldOperator( PhaseExecution.NotificationContext nc )
{
TypeSystemForCodeTransformation ts = nc.TypeSystem;
FieldOperator op = (FieldOperator)nc.CurrentOperator;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
FieldRepresentation fd = op.Field;
{
CustomAttributeRepresentation caFd;
if(ts.RegisterAttributes.TryGetValue( fd, out caFd ))
{
TypeRepresentation tdField = fd.FieldType;
if(tdField is ScalarTypeRepresentation)
{
//
// Scalar fields are handled normally.
//
}
else if(ts.MemoryMappedBitFieldPeripherals.ContainsKey( tdField ))
{
//
// Bitfields are handled normally.
//
}
else
{
TypeRepresentation tdTarget;
if(tdField is ArrayReferenceTypeRepresentation)
{
tdTarget = tdField.ContainedType;
}
else
{
tdTarget = tdField;
}
if(ts.MemoryMappedPeripherals.ContainsKey( tdTarget ) == false)
{
if(tdTarget is ScalarTypeRepresentation)
{
//
// Accept memory-mapped arrays of scalar types.
//
}
else if(ts.MemoryMappedBitFieldPeripherals.ContainsKey( tdTarget ))
{
//
// Arrays of bitfields are handled normally.
//
}
else
{
throw TypeConsistencyErrorException.Create( "Cannot use type '{0}' for Register field '{1}'", tdField.FullNameWithAbbreviation, fd.ToShortString() );
}
}
Operator opNew;
uint offset = (uint)caFd.GetNamedArg( "Offset" );
if(op is LoadInstanceFieldAddressOperator)
{
throw TypeConsistencyErrorException.Create( "Cannot take the address of section '{0}' of memory-mapped peripheral '{1}'", fd.Name, fd.OwnerType.FullNameWithAbbreviation );
}
else if(op is LoadInstanceFieldOperator)
{
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.ADD, false, false, op.FirstResult, op.FirstArgument, nc.TypeSystem.CreateConstant( offset ) );
opNew.AddAnnotation( NotNullAnnotation .Create( ts ) );
opNew.AddAnnotation( MemoryMappedPeripheralAnnotation.Create( ts, caFd ) );
}
else if(op is StoreInstanceFieldOperator)
{
throw TypeConsistencyErrorException.Create( "Cannot update reference to section '{0}' of memory-mapped peripheral '{1}'", fd.Name, fd.OwnerType.FullNameWithAbbreviation );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
return;
}
}
}
{
BitFieldDefinition bfDef;
if(ts.BitFieldRegisterAttributes.TryGetValue( fd, out bfDef ))
{
if((fd.FieldType is ScalarTypeRepresentation) == false)
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
bool fLoad;
if(op is LoadInstanceFieldAddressOperator)
{
throw TypeConsistencyErrorException.Create( "Cannot take the address of section '{0}' of memory-mapped peripheral '{1}'", fd.Name, fd.OwnerType.FullNameWithAbbreviation );
}
else if(op is LoadInstanceFieldOperator)
{
fLoad = true;
}
else if(op is StoreInstanceFieldOperator)
{
fLoad = false;
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
//--//
bool fSigned = fd.FieldType.IsSigned;
TypeRepresentation td = fd.OwnerType;
CustomAttributeRepresentation caTd = ts.MemoryMappedBitFieldPeripherals[td];
TypeRepresentation tdPhysical = caTd.GetNamedArg< TypeRepresentation >( "PhysicalType" );
VariableExpression tmp = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
Operator opNew;
op.AddOperatorBefore( LoadIndirectOperator.New( debugInfo, tdPhysical, tmp, op.FirstArgument, null, fd.Offset, true, false ) );
if(bfDef.Sections.Length == 1)
{
var sec = bfDef.Sections[0];
uint position = sec.Position;
uint size = sec.Size;
Runtime.BitFieldModifier modifiers = sec.Modifiers;
//--//
uint mask = (1u << (int)size) - 1u;
uint maskShifted = mask << (int)position;
if(fLoad)
{
if(position == 0 && fSigned == false)
{
//
// TODO: Add ability to verify with Platform Abstraction if it's possible to encode the constant in a single instruction.
//
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, op.FirstResult, tmp, ts.CreateConstant( mask ) );
}
else
{
//
// We need to load the physical register, and extract the bitfield, which we achieve with a left/right shift pair.
//
VariableExpression tmp2 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHL, false , false, tmp2 , tmp , ts.CreateConstant( 32 - (position + size) ) ) );
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHR, fSigned, false, op.FirstResult, tmp2, ts.CreateConstant( 32 - size ) );
}
}
else
{
if(size == 1 && op.SecondArgument is ConstantExpression)
{
//
// Setting/clearing a single bit. No need to perform complex masking.
//
ConstantExpression ex = (ConstantExpression)op.SecondArgument;
ulong val;
if(ex.GetAsUnsignedInteger( out val ) == false)
{
throw TypeConsistencyErrorException.Create( "Expecting a numeric constant, got '{0}'", ex );
}
VariableExpression tmp2 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
if((val & 1) != 0)
{
ConstantExpression exMask = ts.CreateConstant( maskShifted );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.OR, false, false, tmp2, tmp, exMask ) );
}
else
{
ConstantExpression exMaskNot = ts.CreateConstant( ~maskShifted );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, tmp2, tmp, exMaskNot ) );
}
opNew = StoreIndirectOperator.New( debugInfo, td, op.FirstArgument, tmp2, null, fd.Offset, false );
}
else
{
//
// We need to load the physical register, shift it and mask it, then mask and merge with the new value, and finally write it back.
//
VariableExpression tmp2 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
VariableExpression tmp3 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
VariableExpression tmp4 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
VariableExpression tmp5 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
ConstantExpression exMask = ts.CreateConstant( maskShifted );
ConstantExpression exMaskNot = ts.CreateConstant( ~maskShifted );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHL, false, false, tmp2, op.SecondArgument, ts.CreateConstant( position ) ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, tmp3, tmp2 , exMask ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, tmp4, tmp , exMaskNot ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.OR , false, false, tmp5, tmp3 , tmp4 ) );
opNew = StoreIndirectOperator.New( debugInfo, td, op.FirstArgument, tmp5, null, fd.Offset, false );
}
}
}
else
{
uint totalSize = bfDef.TotalSize;
VariableExpression lastVar = null;
foreach(var sec in bfDef.Sections)
{
uint position = sec.Position;
uint size = sec.Size;
uint offset = sec.Offset;
Runtime.BitFieldModifier modifiers = sec.Modifiers;
//--//
uint mask = (1u << (int)size) - 1u;
uint maskShifted = mask << (int)position;
VariableExpression newVar = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
if(fLoad)
{
bool fLastSection = (offset + size == totalSize);
bool fSigned2 = fSigned && fLastSection;
VariableExpression newVarUnshifted = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
if(position == 0 && fSigned2 == false)
{
//
// TODO: Add ability to verify with Platform Abstraction if it's possible to encode the constant in a single instruction.
//
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, newVarUnshifted, tmp, ts.CreateConstant( mask ) ) );
}
else
{
//
// We need to load the physical register, and extract the bitfield, which we achieve with a left/right shift pair.
//
VariableExpression tmp2 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHL, false , false, tmp2 , tmp , ts.CreateConstant( 32 - (position + size) ) ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHR, fSigned2, false, newVarUnshifted, tmp2, ts.CreateConstant( 32 - size ) ) );
}
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHL, false, false, newVar, newVarUnshifted, ts.CreateConstant( offset ) ) );
if(lastVar != null)
{
VariableExpression mergeVar = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.OR, false, false, mergeVar, lastVar, newVar ) );
lastVar = mergeVar;
}
else
{
lastVar = newVar;
}
}
else
{
if(size == 1 && op.SecondArgument is ConstantExpression)
{
//
// Setting/clearing a single bit. No need to perform complex masking.
//
ConstantExpression ex = (ConstantExpression)op.SecondArgument;
ulong val;
if(ex.GetAsUnsignedInteger( out val ) == false)
{
throw TypeConsistencyErrorException.Create( "Expecting a numeric constant, got '{0}'", ex );
}
if((val & (1u << (int)offset)) != 0)
{
ConstantExpression exMask = ts.CreateConstant( maskShifted );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.OR, false, false, newVar, tmp, exMask ) );
}
else
{
ConstantExpression exMaskNot = ts.CreateConstant( ~maskShifted );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, newVar, tmp, exMaskNot ) );
}
}
else
{
//
// We need to load the physical register, shift it and mask it, then mask and merge with the new value, and finally write it back.
//
VariableExpression tmp2 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
VariableExpression tmp3 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
VariableExpression tmp4 = nc.CurrentCFG.AllocateTemporary( tdPhysical, null );
ConstantExpression exMask = ts.CreateConstant( maskShifted );
ConstantExpression exMaskNot = ts.CreateConstant( ~maskShifted );
if(position > offset)
{
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHL, false, false, tmp2, op.SecondArgument, ts.CreateConstant( position - offset ) ) );
}
else
{
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.SHR, false, false, tmp2, op.SecondArgument, ts.CreateConstant( offset - position ) ) );
}
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, tmp3 , tmp2, exMask ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.AND, false, false, tmp4 , tmp , exMaskNot ) );
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.OR , false, false, newVar, tmp3, tmp4 ) );
}
lastVar = newVar;
tmp = lastVar;
}
}
if(fLoad)
{
opNew = SingleAssignmentOperator.New( debugInfo, op.FirstResult, lastVar );
}
else
{
opNew = StoreIndirectOperator.New( debugInfo, td, op.FirstArgument, lastVar, null, fd.Offset, false );
}
}
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
return;
}
}
if(op.MayThrow)
{
FieldOperator opNew;
op.AddOperatorBefore( NullCheckOperator.New( debugInfo, op.FirstArgument ) );
if(op is LoadInstanceFieldAddressOperator)
{
opNew = LoadInstanceFieldAddressOperator.New( debugInfo, fd, op.FirstResult, op.FirstArgument, false );
opNew.AddAnnotation( NotNullAnnotation.Create( ts ) );
}
else if(op is LoadInstanceFieldOperator)
{
opNew = LoadInstanceFieldOperator.New( debugInfo, fd, op.FirstResult, op.FirstArgument, false );
}
else if(op is StoreInstanceFieldOperator)
{
opNew = StoreInstanceFieldOperator.New( debugInfo, fd, op.FirstArgument, op.SecondArgument, false );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
op = opNew;
nc.MarkAsModified();
}
if(op is LoadInstanceFieldOperator)
{
if((fd.Flags & FieldRepresentation.Attributes.NeverNull) != 0)
{
if(op.AddAnnotation( NotNullAnnotation.Create( ts ) ))
{
nc.MarkAsModified();
}
}
if((fd.Flags & FieldRepresentation.Attributes.HasFixedSize) != 0)
{
if(op.AddAnnotation( FixedLengthArrayAnnotation.Create( ts, fd.FixedSize ) ))
{
nc.MarkAsModified();
}
}
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(ElementOperator) )]
private static void Handle_ElementOperator( PhaseExecution.NotificationContext nc )
{
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ElementOperator op = (ElementOperator)nc.CurrentOperator;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exArray = op.FirstArgument;
TypeRepresentation tdElement = exArray.Type.ContainedType;
MemoryMappedPeripheralAnnotation anMemoryMapped = null;
if(exArray is VariableExpression)
{
foreach(Operator arrayDef in nc.CurrentCFG.DataFlow_DefinitionChains[exArray.SpanningTreeIndex])
{
MemoryMappedPeripheralAnnotation an = arrayDef.GetAnnotation< MemoryMappedPeripheralAnnotation >();
if(an != null)
{
if(tdElement is ScalarTypeRepresentation)
{
anMemoryMapped = an;
break;
}
if(ts.MemoryMappedBitFieldPeripherals.ContainsKey( tdElement ))
{
anMemoryMapped = an;
break;
}
//--//
CustomAttributeRepresentation ca;
if(ts.MemoryMappedPeripherals.TryGetValue( tdElement, out ca ))
{
uint size = (uint)ca.GetNamedArg( "Length" );
if(op is LoadElementAddressOperator)
{
throw TypeConsistencyErrorException.Create( "Cannot take the address of an array of memory-mapped sections '{0}'", tdElement.FullNameWithAbbreviation );
}
else if(op is LoadElementOperator)
{
TemporaryVariableExpression tmpOffset = nc.AllocateTemporary( nc.TypeSystem.WellKnownTypes.System_UInt32 );
Operator opNew;
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.MUL, false, false, tmpOffset, op.SecondArgument, nc.TypeSystem.CreateConstant( size ) );
op.AddOperatorBefore( opNew );
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.ADD, false, false, op.FirstResult, exArray, tmpOffset );
opNew.AddAnnotation( NotNullAnnotation .Create( ts ) );
opNew.AddAnnotation( MemoryMappedPeripheralAnnotation.Create( ts, ca ) );
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
return;
}
else if(op is StoreElementOperator)
{
throw TypeConsistencyErrorException.Create( "Cannot update reference to an array of memory-mapped sections '{0}'", tdElement.FullNameWithAbbreviation );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
}
}
}
}
if(op.MayThrow)
{
ElementOperator opNew;
if(anMemoryMapped == null)
{
op.AddOperatorBefore( NullCheckOperator .New( debugInfo, op.FirstArgument ) );
op.AddOperatorBefore( OutOfBoundCheckOperator.New( debugInfo, op.FirstArgument, op.SecondArgument ) );
}
if(op is LoadElementAddressOperator)
{
opNew = LoadElementAddressOperator.New( debugInfo, op.FirstResult, op.FirstArgument, op.SecondArgument, op.AccessPath, false );
opNew.AddAnnotation( NotNullAnnotation.Create( ts ) );
}
else if(op is LoadElementOperator)
{
opNew = LoadElementOperator.New( debugInfo, op.FirstResult, op.FirstArgument, op.SecondArgument, op.AccessPath, false );
}
else if(op is StoreElementOperator)
{
opNew = StoreElementOperator.New( debugInfo, op.FirstArgument, op.SecondArgument, op.ThirdArgument, op.AccessPath, false );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
if(anMemoryMapped != null)
{
opNew.AddAnnotation( anMemoryMapped );
}
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(IndirectOperator) )]
private static void Handle_IndirectOperator( PhaseExecution.NotificationContext nc )
{
IndirectOperator op = (IndirectOperator)nc.CurrentOperator;
if(op.MayThrow)
{
Debugging.DebugInfo debugInfo = op.DebugInfo;
bool fIsVolatile = op.MayMutateExistingStorage;
Operator opNew;
op.AddOperatorBefore( NullCheckOperator.New( debugInfo, op.FirstArgument ) );
if(op is LoadIndirectOperator)
{
opNew = LoadIndirectOperator.New( debugInfo, op.Type, op.FirstResult, op.FirstArgument, op.AccessPath, op.Offset, fIsVolatile, false );
}
else if(op is StoreIndirectOperator)
{
opNew = StoreIndirectOperator.New( debugInfo, op.Type, op.FirstArgument, op.SecondArgument, op.AccessPath, op.Offset, false );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
CHECKS.ASSERT( opNew.MayThrow == false, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(CallOperator) )]
private static void Handle_CallOperator( PhaseExecution.NotificationContext nc )
{
CallOperator op = (CallOperator)nc.CurrentOperator;
if(nc.TypeSystem.GetLevel( op )> Operator.OperatorLevel.ConcreteTypes_NoExceptions)
{
Debugging.DebugInfo debugInfo = op.DebugInfo;
CallOperator opNew;
if(op is InstanceCallOperator)
{
op.AddOperatorBefore( NullCheckOperator.New( debugInfo, op.FirstArgument ) );
opNew = InstanceCallOperator.New( debugInfo, op.CallType, op.TargetMethod, op.Results, op.Arguments, false );
}
else if(op is IndirectCallOperator)
{
op.AddOperatorBefore( NullCheckOperator.New( debugInfo, op.FirstArgument ) );
if(op.TargetMethod is InstanceMethodRepresentation)
{
op.AddOperatorBefore( NullCheckOperator.New( debugInfo, op.SecondArgument ) );
}
bool isInstanceCall = ((IndirectCallOperator)op).IsInstanceCall;
opNew = IndirectCallOperator.New(debugInfo, op.TargetMethod, op.Results, op.Arguments, isInstanceCall, false);
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
CHECKS.ASSERT( nc.TypeSystem.GetLevel( opNew )<= Operator.OperatorLevel.ConcreteTypes_NoExceptions, "Failed to lower call operator {0}", op );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_MidLevelToLowLevel.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class OperatorHandlers_MidLevelToLowLevel
{
[CompilationSteps.PhaseFilter( typeof(Phases.MidLevelToLowLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(FieldOperator) )]
private static void Handle_FieldOperator( PhaseExecution.NotificationContext nc )
{
FieldOperator op = (FieldOperator)nc.CurrentOperator;
FieldRepresentation fd = op.Field;
Debugging.DebugInfo debugInfo = op.DebugInfo;
bool fIsVolatile = (fd.Flags & FieldRepresentation.Attributes.IsVolatile) != 0;
Operator opNew;
CHECKS.ASSERT( op.MayThrow == false, "Unexpected throwing operator: {0}", op );
if(op is LoadInstanceFieldAddressOperator)
{
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.ADD, false, false, op.FirstResult, op.FirstArgument, nc.TypeSystem.CreateConstant( fd.Offset ) );
}
else if(op is LoadInstanceFieldOperator)
{
opNew = LoadIndirectOperator.New( debugInfo, fd.FieldType, op.FirstResult, op.FirstArgument, new FieldRepresentation[] { fd }, fd.Offset, fIsVolatile, false );
}
else if(op is StoreInstanceFieldOperator)
{
opNew = StoreIndirectOperator.New( debugInfo, fd.FieldType, op.FirstArgument, op.SecondArgument, new FieldRepresentation[] { fd }, fd.Offset, false );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.MidLevelToLowLevelConversion) )]
[CompilationSteps.OperatorHandler( typeof(ElementOperator) )]
private static void Handle_ElementOperator( PhaseExecution.NotificationContext nc )
{
ElementOperator op = (ElementOperator)nc.CurrentOperator;
Debugging.DebugInfo debugInfo = op.DebugInfo;
Expression exArray = op.FirstArgument;
Expression exIndex = op.SecondArgument;
TypeRepresentation tdArray = exArray.Type;
TypeRepresentation tdElement = tdArray.ContainedType;
TypeRepresentation tdElementPtr = nc.TypeSystem.GetManagedPointerToType( tdElement );
TemporaryVariableExpression tmpPtr = nc.CurrentCFG.AllocateTemporary( tdElementPtr , null );
TemporaryVariableExpression tmpOffset = nc.CurrentCFG.AllocateTemporary( nc.TypeSystem.WellKnownTypes.System_Int32, null );
Operator opNew;
//
// Get a pointer to the first element.
//
if(op.HasAnnotation< MemoryMappedPeripheralAnnotation >())
{
//
// A memory-mapped array doesn't have any length field.
//
opNew = SingleAssignmentOperator.New( debugInfo, tmpPtr, exArray );
}
else
{
//
// Skip the length field.
//
opNew = BinaryOperator.New( debugInfo, BinaryOperator.ALU.ADD, false, false, tmpPtr, exArray, nc.TypeSystem.CreateConstant( tdArray.VirtualTable.BaseSize ) );
}
opNew.AddAnnotation( NotNullAnnotation.Create( nc.TypeSystem ) );
op.AddOperatorBefore( opNew );
//
// Compute byte-offset within the array.
//
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.MUL, false, false, tmpOffset, exIndex, nc.TypeSystem.CreateConstant( tdArray.VirtualTable.ElementSize ) ) );
//
// Compute the address of the element to access.
//
op.AddOperatorBefore( BinaryOperator.New( debugInfo, BinaryOperator.ALU.ADD, false, false, tmpPtr, tmpPtr, tmpOffset ) );
if(op is LoadElementAddressOperator)
{
opNew = SingleAssignmentOperator.New( debugInfo, op.FirstResult, tmpPtr );
}
else if(op is LoadElementOperator)
{
opNew = LoadIndirectOperator.New( debugInfo, tdElement, op.FirstResult, tmpPtr, op.AccessPath, 0, false, false );
}
else if(op is StoreElementOperator)
{
opNew = StoreIndirectOperator.New( debugInfo, tdElement, tmpPtr, op.ThirdArgument, op.AccessPath, 0, false );
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected operator {0} at phase {1}", op, nc.Phase );
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
nc.MarkAsModified();
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/OperatorHandlers_ReferenceCountingGarbageCollection.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases;
using Runtime.TypeSystem;
using System;
public class OperatorHandlers_ReferenceCountingGarbageCollection
{
[CompilationSteps.PhaseFilter( typeof( Phases.ReferenceCountingGarbageCollection ) )]
[CompilationSteps.OperatorHandler( typeof( SingleAssignmentOperator ) )]
[CompilationSteps.OperatorHandler( typeof( CallOperator ) )]
[CompilationSteps.OperatorHandler( typeof( StoreInstanceFieldOperator ) )]
[CompilationSteps.OperatorHandler( typeof( LoadInstanceFieldOperator ) )]
[CompilationSteps.OperatorHandler( typeof( StoreElementOperator ) )]
[CompilationSteps.OperatorHandler( typeof( LoadElementOperator ) )]
[CompilationSteps.OperatorHandler( typeof( StoreIndirectOperator ) )]
[CompilationSteps.OperatorHandler( typeof( LoadIndirectOperator ) )]
private static void Handle_AssignmentOperators( PhaseExecution.NotificationContext nc )
{
var op = nc.CurrentOperator;
var ts = nc.TypeSystem;
var phase = (ReferenceCountingGarbageCollection)nc.Phase;
if(!ts.ShouldExcludeMethodFromReferenceCounting( op.BasicBlock.Owner.Method ) &&
!phase.IsOperatorModified( op ))
{
if(op is SingleAssignmentOperator)
{
Handle_SingleAssignmentOperator( nc );
}
else if(op is CallOperator)
{
Handle_CallOperator( nc );
}
else if(op is StoreInstanceFieldOperator)
{
Handle_StoreInstanceFieldOperator( nc );
}
else if(op is LoadInstanceFieldOperator)
{
Handle_LoadInstanceFieldOperator( nc );
}
else if(op is StoreElementOperator)
{
Handle_StoreElementOperator( nc );
}
else if(op is LoadElementOperator)
{
Handle_LoadElementOperator( nc );
}
else if(op is StoreIndirectOperator)
{
Handle_StoreIndirectOperator( nc );
}
else if(op is LoadIndirectOperator)
{
Handle_LoadIndirectOperator( nc );
}
phase.AddToModifiedOperator( op );
}
}
private enum RefCountType
{
None = 0,
RefCounted,
Pointer,
Skipped,
}
private static RefCountType GetRefCountType( PhaseExecution.NotificationContext nc,
Expression exp )
{
var variable = exp as VariableExpression;
if(variable != null)
{
var refCountType = GetRefCountType( nc, variable.Type );
if (refCountType == RefCountType.RefCounted && variable.SkipReferenceCounting)
{
return RefCountType.Skipped;
}
return refCountType;
}
return RefCountType.None;
}
private static RefCountType GetRefCountType( PhaseExecution.NotificationContext nc,
TypeRepresentation type )
{
var rctype = RefCountType.None;
var ts = nc.TypeSystem;
if(ts.IsReferenceCountingType( type ))
{
rctype = RefCountType.RefCounted;
}
else if(type == ts.WellKnownTypes.System_UIntPtr || type == ts.WellKnownTypes.System_IntPtr)
{
rctype = RefCountType.Pointer;
}
return rctype;
}
private static void InsertAddRefBefore( PhaseExecution.NotificationContext nc, Expression argument )
{
InsertMethodHelper( nc,
nc.TypeSystem.WellKnownMethods.ObjectHeader_AddReference,
argument,
insertBefore: true );
}
private static void InsertAddRefAfter( PhaseExecution.NotificationContext nc, Expression argument )
{
InsertMethodHelper( nc,
nc.TypeSystem.WellKnownMethods.ObjectHeader_AddReference,
argument,
insertBefore: false );
}
private static void InsertReleaseBefore( PhaseExecution.NotificationContext nc, Expression argument )
{
InsertMethodHelper( nc,
nc.TypeSystem.WellKnownMethods.ObjectHeader_ReleaseReference,
argument,
insertBefore: true );
}
private static void InsertMethodHelper( PhaseExecution.NotificationContext nc,
Runtime.TypeSystem.MethodRepresentation md,
Expression argument,
bool insertBefore )
{
var op = nc.CurrentOperator;
var ts = nc.TypeSystem;
var rhs = ts.AddTypePointerToArgumentsOfStaticMethod( md, argument );
var call = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, rhs );
if(insertBefore)
{
op.AddOperatorBefore( call );
}
else
{
op.AddOperatorAfter( call );
}
var phase = (Phases.ReferenceCountingGarbageCollection)nc.Phase;
phase.AddToModifiedOperator( call );
phase.IncrementInjectionCount( md );
nc.MarkAsModified( );
}
private static void Handle_SingleAssignmentOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstResult = FirstArgument
var op = (SingleAssignmentOperator)nc.CurrentOperator;
var lhsRefCountType = GetRefCountType( nc, op.FirstResult );
var rhsRefCountType = GetRefCountType( nc, op.FirstArgument );
if(lhsRefCountType == RefCountType.RefCounted)
{
// Need to addref the RHS if both LHS and RHS are ref-counted.
// Note, we also need to do this if LHS is refcounted and RHS is refcounted but skipped
// so we don't mess up the ref count of the LHS.
// Also note, this means that we won't addref when we assign ref-counted object to
// non-refcounted objects or IntPtr / UIntptr (effectively treating them as weak reference)
if( rhsRefCountType == RefCountType.RefCounted ||
rhsRefCountType == RefCountType.Skipped)
{
InsertAddRefBefore( nc, op.FirstArgument );
}
// If LHS has a ref-counted type, we should always call Release (it'll just be no-op if the
// actual object is not)
InsertReleaseBefore( nc, op.FirstResult );
// We are assigning a weak pointer (IntPtr / UIntPtr) to a ref-counted type. We need to
// assume a reference since it's now assigned to a proper object.
if(rhsRefCountType == RefCountType.Pointer)
{
InsertAddRefAfter( nc, op.FirstResult );
}
}
}
private static void Handle_CallOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstResult = TargetMethod()
var op = (CallOperator)nc.CurrentOperator;
var lhsRefCountType =
( op.Results.Length > 0 ) ? GetRefCountType( nc, op.FirstResult.Type ) : RefCountType.None;
if(lhsRefCountType == RefCountType.RefCounted)
{
InsertReleaseBefore( nc, op.FirstResult );
}
}
private static void Handle_StoreInstanceFieldOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstArgument.Field = SecondArgument
Handle_StoreOperators(
nc : nc,
lhsType : ( (StoreFieldOperator)nc.CurrentOperator ).Field.FieldType,
loadLhsAddr: ( op, tempVar ) => LoadInstanceFieldAddressOperator.New(
op.DebugInfo,
( (FieldOperator)op ).Field,
tempVar,
op.FirstArgument,
fNullCheck: false ),
rhs : nc.CurrentOperator.SecondArgument );
}
private static void Handle_LoadInstanceFieldOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstResult = FirstArgument.Field
Handle_LoadOperators(
nc : nc,
lhs : nc.CurrentOperator.FirstResult,
rhsType : ( (LoadFieldOperator)nc.CurrentOperator ).Field.FieldType,
loadRhsAddr: ( op, tempVar ) => LoadInstanceFieldAddressOperator.New(
op.DebugInfo,
( (FieldOperator)op ).Field,
tempVar,
op.FirstArgument,
fNullCheck: false ) );
}
private static void Handle_StoreElementOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstArgument[SecondArgument] = ThirdArgument
Handle_StoreOperators(
nc : nc,
lhsType : nc.CurrentOperator.FirstArgument.Type.ContainedType,
loadLhsAddr: ( op, tempVar ) => LoadElementAddressOperator.New(
op.DebugInfo,
tempVar,
op.FirstArgument,
op.SecondArgument,
( (ElementOperator)op ).AccessPath,
fNullCheck: false ),
rhs : nc.CurrentOperator.ThirdArgument );
}
private static void Handle_LoadElementOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstResult = FirstArgument[SecondArgument]
Handle_LoadOperators(
nc : nc,
lhs : nc.CurrentOperator.FirstResult,
rhsType : nc.CurrentOperator.FirstArgument.Type.ContainedType,
loadRhsAddr: ( op, tempVar ) => LoadElementAddressOperator.New(
op.DebugInfo,
tempVar,
op.FirstArgument,
op.SecondArgument,
( (ElementOperator)op ).AccessPath,
fNullCheck: false ) );
}
private static void Handle_StoreIndirectOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstArgument[Offset] = SecondArgument
Handle_StoreOperators(
nc : nc,
lhsType : nc.CurrentOperator.FirstArgument.Type.ContainedType,
loadLhsAddr: delegate( Operator op, TemporaryVariableExpression tempVar )
{
CHECKS.ASSERT( ( (IndirectOperator)op ).Offset == 0, "No support for non-zero offset" );
return SingleAssignmentOperator.New( op.DebugInfo, tempVar, op.FirstArgument );
},
rhs : nc.CurrentOperator.SecondArgument );
}
private static void Handle_LoadIndirectOperator( PhaseExecution.NotificationContext nc )
{
// Syntax: FirstResult = FirstArgument[Offset]
Handle_LoadOperators(
nc : nc,
lhs : nc.CurrentOperator.FirstResult,
rhsType : nc.CurrentOperator.FirstArgument.Type.ContainedType,
loadRhsAddr: delegate ( Operator op, TemporaryVariableExpression tempVar )
{
CHECKS.ASSERT( ( (IndirectOperator)op ).Offset == 0, "No support for non-zero offset" );
return SingleAssignmentOperator.New( op.DebugInfo, tempVar, op.FirstArgument );
} );
}
private static void Handle_StoreOperators(
PhaseExecution.NotificationContext nc,
TypeRepresentation lhsType,
Func loadLhsAddr,
Expression rhs )
{
var op = nc.CurrentOperator;
var lhsRefCountType = GetRefCountType( nc, lhsType );
if(lhsRefCountType == RefCountType.RefCounted)
{
var tempAddr = nc.CurrentCFG.AllocateTemporary(
nc.TypeSystem.GetManagedPointerToType( nc.TypeSystem.WellKnownTypes.System_Object ),
null );
Operator loadAddrOp = loadLhsAddr( op, tempAddr );
op.AddOperatorBefore( loadAddrOp );
var swap = nc.TypeSystem.WellKnownMethods.ReferenceCountingCollector_Swap;
var swapRHS = nc.TypeSystem.AddTypePointerToArgumentsOfStaticMethod(
swap,
tempAddr,
rhs );
var swapCall = StaticCallOperator.New(
op.DebugInfo,
CallOperator.CallKind.Direct,
swap,
VariableExpression.SharedEmptyArray,
swapRHS );
op.SubstituteWithOperator( swapCall, Operator.SubstitutionFlags.Default );
var phase = (ReferenceCountingGarbageCollection)nc.Phase;
phase.AddToModifiedOperator( swapCall );
phase.IncrementInjectionCount( swap );
}
}
private static void Handle_LoadOperators(
PhaseExecution.NotificationContext nc,
VariableExpression lhs,
TypeRepresentation rhsType,
Func loadRhsAddr )
{
var op = nc.CurrentOperator;
var lhsRefCountType = GetRefCountType( nc, lhs );
var rhsRefCountType = GetRefCountType( nc, rhsType );
// Note that we are calling Release() first then AddRef() here. This is OK because the field
// will always hold a valid reference, so the first Release() can never cause the ref count to
// bounce zero.
// If LHS has a ref-counted type, we should always call Release (it'll just be no-op if the
// actual object is not)
if(lhsRefCountType == RefCountType.RefCounted)
{
InsertReleaseBefore( nc, lhs );
// Need to Addref the RHS if it's a ref-counted type.
if(rhsRefCountType == RefCountType.RefCounted)
{
// Create a temporary variable to store the address of the field object
var tempAddr = nc.CurrentCFG.AllocateTemporary(
nc.TypeSystem.GetManagedPointerToType( nc.TypeSystem.WellKnownTypes.System_Object ),
null );
var loadAddrOp = loadRhsAddr(op, tempAddr);
op.AddOperatorBefore( loadAddrOp );
var loadAndAddRef = nc.TypeSystem.WellKnownMethods.ReferenceCountingCollector_LoadAndAddReference;
var loadAndAddRefRHS = nc.TypeSystem.AddTypePointerToArgumentsOfStaticMethod( loadAndAddRef, tempAddr );
var loadAndAddRefCall = StaticCallOperator.New( op.DebugInfo,
CallOperator.CallKind.Direct,
loadAndAddRef,
new VariableExpression[] { lhs },
loadAndAddRefRHS );
op.SubstituteWithOperator( loadAndAddRefCall, Operator.SubstitutionFlags.Default );
var phase = (ReferenceCountingGarbageCollection)nc.Phase;
phase.AddToModifiedOperator( loadAndAddRefCall );
phase.IncrementInjectionCount( loadAndAddRef );
}
}
}
[CompilationSteps.PhaseFilter( typeof( Phases.ReferenceCountingGarbageCollection ) )]
[CompilationSteps.OperatorHandler( typeof( StaticCallOperator ) )]
private static void Handle_RedundantRefCountingCalls( PhaseExecution.NotificationContext nc )
{
var op = (StaticCallOperator)nc.CurrentOperator;
var ts = nc.TypeSystem;
var wkm = ts.WellKnownMethods;
var md = op.TargetMethod;
// Remove redundant AddReference(null) and ReleaseReference(null)
if(md == wkm.ObjectHeader_AddReference || md == wkm.ObjectHeader_ReleaseReference)
{
var arg = op.SecondArgument as ConstantExpression;
if(arg != null && arg.Value == null)
{
op.Delete( );
( (ReferenceCountingGarbageCollection)nc.Phase ).DecrementInjectionCount( md );
nc.MarkAsModified( );
}
}
}
[CompilationSteps.PhaseFilter( typeof( Phases.ReferenceCountingGarbageCollection ) )]
[CompilationSteps.OperatorHandler( typeof( StaticCallOperator ) )]
private static void Handle_ReplaceFastAllocateString( PhaseExecution.NotificationContext nc )
{
var op = (StaticCallOperator)nc.CurrentOperator;
var ts = nc.TypeSystem;
var wkm = ts.WellKnownMethods;
var allocString = wkm.StringImpl_FastAllocateString;
if(allocString != null && op.TargetMethod == allocString)
{
var allocStrCall = StaticCallOperator.New( op.DebugInfo,
CallOperator.CallKind.Direct,
wkm.StringImpl_FastAllocateReferenceCountingString,
op.Results,
op.Arguments );
op.SubstituteWithOperator( allocStrCall, Operator.SubstitutionFlags.Default );
var phase = (ReferenceCountingGarbageCollection)nc.Phase;
if(phase.IsOperatorModified( op ))
{
phase.AddToModifiedOperator( allocStrCall );
}
nc.MarkAsModified( );
}
}
[CompilationSteps.PhaseFilter( typeof( Phases.ReferenceCountingGarbageCollection ) )]
[CompilationSteps.OperatorHandler( typeof( StaticCallOperator ) )]
private static void Handle_ReplaceInternalInterlockedMethods( PhaseExecution.NotificationContext nc )
{
// Various Interlocked methods like Exchange and CompareExchange are being replaced by
// LLVM atomic instruction, and as such, they do not properly account for reference counting
// This handler will wrap the calls with the proper reference counting methods (as implemented
// in InterlockedImpl.ReferenceCounting* methods)
var op = (StaticCallOperator)nc.CurrentOperator;
var ts = nc.TypeSystem;
var wkm = ts.WellKnownMethods;
var internalExchange = wkm.InterlockedImpl_InternalExchange_Template;
var internalCompareExchange = wkm.InterlockedImpl_InternalCompareExchange_Template;
var refCountExchange = wkm.ReferenceCountingCollector_ReferenceCountingExchange;
var refCountCompareExchange = wkm.ReferenceCountingCollector_ReferenceCountingCompareExchange;
var md = op.TargetMethod;
var owner = op.BasicBlock.Owner.Method;
// Do not replace the call in ReferenceCountingExchange or ReferenceCountingCompareExchange
if(owner == refCountExchange || owner == refCountCompareExchange)
{
return;
}
if(md.IsGenericInstantiation &&
(md.GenericTemplate == internalExchange || md.GenericTemplate == internalCompareExchange))
{
var isCompareExchange = md.GenericTemplate == internalCompareExchange;
// Generate the unsafe cast from T& to object&
var tempPtr = nc.CurrentCFG.AllocateTemporary(
nc.TypeSystem.GetManagedPointerToType( nc.TypeSystem.WellKnownTypes.System_Object ),
null );
var unsafeCastOp = SingleAssignmentOperator.New( op.DebugInfo, tempPtr, op.SecondArgument );
op.AddOperatorBefore( unsafeCastOp );
// Replace the T& with the new temporary
Expression[] args = (Expression[])op.Arguments.Clone( );
args[ 1 ] = tempPtr;
var call = StaticCallOperator.New(
op.DebugInfo,
CallOperator.CallKind.Direct,
isCompareExchange ? refCountCompareExchange : refCountExchange,
op.Results,
args );
op.SubstituteWithOperator( call, Operator.SubstitutionFlags.Default );
var phase = (ReferenceCountingGarbageCollection)nc.Phase;
if(phase.IsOperatorModified( op ))
{
phase.AddToModifiedOperator( call );
}
nc.MarkAsModified( );
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/Optimizations.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define DUMP_CONSTRAINTSYSTEM
// LLVM translation doesn't yet recognize SSA format, and will not produce correct code.
// TODO: Remove this tag when that issue has been resolved.
//#define ALLOW_SSA_FORM
// Enable optimizations that only work for direct ARM translation (non-LLVM legacy path).
// TODO: Remove this tag when comparison is no longer needed.
//#define ENABLE_LOW_LEVEL_OPTIMIZATIONS
// Enable more advanced optimizations which look for non-equivalent comparisons. This appears to be
// overly aggressive when not in SSA form, resulting in incorrect code.
// TODO: Remove this tag when this issue is resolved.
//#define ENABLE_ADVANCED_COMPARES
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class Optimizations
{
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
#if ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true, RunInExtendedSSAForm = true)]
#else // ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true)]
#endif // ALLOW_SSA_FORM
private static void RemoveRedundantChecks( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
while(true)
{
GrowOnlyHashTable< VariableExpression, Operator > defLookup = cfg.DataFlow_SingleDefinitionLookup;
if(PropagateFixedArrayLength( cfg, defLookup ) ||
RemoveRedundantChecks( cfg, defLookup ) )
{
Transformations.RemoveDeadCode.Execute( cfg, false );
continue;
}
break;
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static bool PropagateFixedArrayLength( ControlFlowGraphStateForCodeTransformation cfg ,
GrowOnlyHashTable< VariableExpression, Operator > defLookup )
{
bool fRunSimplify = false;
#if ENABLE_LOW_LEVEL_OPTIMIZATIONS
foreach(var op in cfg.FilterOperators< LoadIndirectOperator >())
#else // ENABLE_LOW_LEVEL_OPTIMIZATIONS
foreach(var op in cfg.FilterOperators< LoadInstanceFieldOperator >())
#endif // ENABLE_LOW_LEVEL_OPTIMIZATIONS
{
if(op.HasAnnotation< ArrayLengthAnnotation >())
{
FixedLengthArrayAnnotation an = FindFixedLengthArrayAnnotation( defLookup, op.FirstArgument );
if(an != null)
{
var var = op.FirstResult;
var opNew = SingleAssignmentOperator.New( op.DebugInfo, var, cfg.TypeSystem.CreateConstant( (uint)an.ArrayLength ) );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
defLookup[var] = op;
fRunSimplify = true;
}
}
}
return fRunSimplify;
}
private static FixedLengthArrayAnnotation FindFixedLengthArrayAnnotation( GrowOnlyHashTable< VariableExpression, Operator > defLookup ,
Expression ex )
{
return FindFixedLengthArrayAnnotation( defLookup, SetFactory.NewWithReferenceEquality< VariableExpression >(), ex );
}
private static FixedLengthArrayAnnotation FindFixedLengthArrayAnnotation( GrowOnlyHashTable< VariableExpression, Operator > defLookup ,
GrowOnlySet< VariableExpression > history ,
Expression ex )
{
var array = ex as VariableExpression;
if(array == null || history.Insert( array ))
{
//
// Detected loop, bail out.
//
return null;
}
//--//
Operator arrayDef;
if(defLookup.TryGetValue( array, out arrayDef ))
{
var an = arrayDef.GetAnnotation< FixedLengthArrayAnnotation >();
if(an != null)
{
return an;
}
if(arrayDef is PhiOperator)
{
foreach(Expression rhs in arrayDef.Arguments)
{
FixedLengthArrayAnnotation an2 = FindFixedLengthArrayAnnotation( defLookup, history, rhs );
if(an2 == null)
{
return null;
}
if(an == null)
{
an = an2;
}
else if(an.ArrayLength != an2.ArrayLength)
{
return null;
}
}
return an;
}
if(arrayDef is SingleAssignmentOperator ||
arrayDef is PiOperator )
{
return FindFixedLengthArrayAnnotation( defLookup, history, arrayDef.FirstArgument );
}
}
return null;
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static bool RemoveRedundantChecks(
ControlFlowGraphStateForCodeTransformation cfg,
GrowOnlyHashTable< VariableExpression, Operator > defLookup )
{
var useChains = cfg.DataFlow_UseChains;
bool fRunSimplify = false;
cfg.ResetCacheCheckpoint( );
foreach(var controlOp in cfg.FilterOperators< BinaryConditionalControlOperator >())
{
BasicBlock takenBranch = TryGetUnconditionalBranchTarget( controlOp, defLookup, useChains );
if(takenBranch != null)
{
UnconditionalControlOperator opNewCtrl = UnconditionalControlOperator.New( controlOp.DebugInfo, takenBranch );
controlOp.SubstituteWithOperator( opNewCtrl, Operator.SubstitutionFlags.Default );
fRunSimplify = true;
}
}
// If modified, we need to refresh useChains in case variables were changed. If we don't do this, FilterOperators
// below will refresh the operators, and SpanningTreeIndex and other info between variables and our stale useChains
// may be mismatched.
if(fRunSimplify)
{
cfg.AssertNoCacheRefreshSinceCheckpoint( );
useChains = cfg.DataFlow_UseChains;
cfg.ResetCacheCheckpoint( );
}
var cscUpperBound = new Transformations.ConstraintSystemCollector( cfg, Transformations.ConstraintSystemCollector.Kind.LessThanOrEqual );
var cscLowerBound = new Transformations.ConstraintSystemCollector( cfg, Transformations.ConstraintSystemCollector.Kind.GreaterThanOrEqual );
foreach(var controlOp in cfg.FilterOperators< CompareConditionalControlOperator >())
{
BasicBlock takenBranch = TryGetUnconditionalBranchTarget( cscUpperBound, cscLowerBound, controlOp, defLookup, useChains );
if(takenBranch != null)
{
UnconditionalControlOperator opNewCtrl = UnconditionalControlOperator.New( controlOp.DebugInfo, takenBranch );
controlOp.SubstituteWithOperator( opNewCtrl, Operator.SubstitutionFlags.Default );
fRunSimplify = true;
}
}
#if ENABLE_LOW_LEVEL_OPTIMIZATIONS
foreach(var controlOp in cfg.FilterOperators< ConditionCodeConditionalControlOperator >())
{
bool fNotEqual;
switch(controlOp.Condition)
{
case ConditionCodeExpression.Comparison.NotEqual:
fNotEqual = true;
break;
case ConditionCodeExpression.Comparison.Equal:
fNotEqual = false;
break;
default:
continue;
}
var opCmp = ControlFlowGraphState.CheckSingleDefinition( defLookup, controlOp.FirstArgument ) as CompareOperator;
if(opCmp != null)
{
bool fNullOnRight;
Expression ex = opCmp.IsBinaryOperationAgainstZeroValue( out fNullOnRight );
if(ex != null)
{
if(ProveNonZero( defLookup, ex ) == ProveResult.True)
{
UnconditionalControlOperator opNewCtrl = UnconditionalControlOperator.New( controlOp.DebugInfo, fNotEqual ? controlOp.TargetBranchTaken : controlOp.TargetBranchNotTaken );
controlOp.SubstituteWithOperator( opNewCtrl, Operator.SubstitutionFlags.Default );
fRunSimplify = true;
}
}
}
}
foreach (var controlOp in cfg.FilterOperators< ConditionCodeConditionalControlOperator >())
{
var opCmp = ControlFlowGraphState.CheckSingleDefinition( defLookup, controlOp.FirstArgument ) as CompareOperator;
if(opCmp != null)
{
ProveResult result = ProveComparison( cscUpperBound, cscLowerBound, opCmp.FirstArgument, opCmp.SecondArgument, controlOp.Condition );
if(result != ProveResult.Unknown)
{
BasicBlock takenBranch = (result == ProveResult.AlwaysTrue) ? controlOp.TargetBranchTaken : controlOp.TargetBranchNotTaken;
UnconditionalControlOperator opNewCtrl = UnconditionalControlOperator.New( controlOp.DebugInfo, takenBranch );
controlOp.SubstituteWithOperator( opNewCtrl, Operator.SubstitutionFlags.Default );
fRunSimplify = true;
}
}
}
#endif // ENABLE_LOW_LEVEL_OPTIMIZATIONS
cfg.AssertNoCacheRefreshSinceCheckpoint( );
return fRunSimplify;
}
bool SomeProperty
{
get; set;
}
private static BasicBlock TryGetUnconditionalBranchTarget(
BinaryConditionalControlOperator controlOp,
GrowOnlyHashTable defLookup,
Operator[][] useChains)
{
// Replace binary branches with unconditional ones when both targets are the same block.
if (controlOp.TargetBranchTaken == controlOp.TargetBranchNotTaken)
{
return controlOp.TargetBranchTaken;
}
switch (ProveNonZero(controlOp.FirstArgument, defLookup, useChains))
{
case ProveResult.AlwaysTrue:
return controlOp.TargetBranchTaken;
case ProveResult.NeverTrue:
return controlOp.TargetBranchNotTaken;
}
return null;
}
private static BasicBlock TryGetUnconditionalBranchTarget(
Transformations.ConstraintSystemCollector cscUpperBound,
Transformations.ConstraintSystemCollector cscLowerBound,
CompareConditionalControlOperator controlOp,
GrowOnlyHashTable defLookup,
Operator[][] useChains)
{
// Replace binary branches with unconditional ones when both targets are the same block.
if (controlOp.TargetBranchTaken == controlOp.TargetBranchNotTaken)
{
return controlOp.TargetBranchTaken;
}
ProveResult result = ProveResult.Unknown;
switch (controlOp.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ:
case CompareAndSetOperator.ActionCondition.NE:
bool fNullOnRight;
Expression expr = controlOp.IsBinaryOperationAgainstZeroValue(out fNullOnRight);
if (expr == null)
{
break;
}
result = ProveNonZero(expr, defLookup, useChains);
if (result == ProveResult.Unknown)
{
break;
}
// Invert the result for (expr == 0)
if (controlOp.Condition == CompareAndSetOperator.ActionCondition.EQ)
{
if (result == ProveResult.AlwaysTrue)
{
result = ProveResult.NeverTrue;
}
else
{
result = ProveResult.AlwaysTrue;
}
}
break;
#if ENABLE_ADVANCED_COMPARES
case CompareAndSetOperator.ActionCondition.LT:
result = ProveLessThanOrEqual(cscUpperBound, cscLowerBound, controlOp.FirstArgument, controlOp.SecondArgument, weight: -1);
break;
case CompareAndSetOperator.ActionCondition.LE:
result = ProveLessThanOrEqual(cscUpperBound, cscLowerBound, controlOp.FirstArgument, controlOp.SecondArgument, weight: 0);
break;
case CompareAndSetOperator.ActionCondition.GT:
result = ProveLessThanOrEqual(cscUpperBound, cscLowerBound, controlOp.SecondArgument, controlOp.FirstArgument, weight: -1);
break;
case CompareAndSetOperator.ActionCondition.GE:
result = ProveLessThanOrEqual(cscUpperBound, cscLowerBound, controlOp.SecondArgument, controlOp.FirstArgument, weight: 0);
break;
#endif // ENABLE_ADVANCED_COMPARES
}
switch (result)
{
case ProveResult.AlwaysTrue:
return controlOp.TargetBranchTaken;
case ProveResult.NeverTrue:
return controlOp.TargetBranchNotTaken;
default:
return null;
}
}
private enum ProveResult
{
Unknown = 0,
AlwaysTrue,
NeverTrue,
}
private static ProveResult ProveNonZero(
Expression ex,
GrowOnlyHashTable< VariableExpression, Operator > defLookup,
Operator[][] useChains )
{
return ProveNonZero( ex, defLookup, useChains, SetFactory.NewWithReferenceEquality< VariableExpression >() );
}
private static ProveResult ProveNonZero(
Expression ex,
GrowOnlyHashTable< VariableExpression, Operator > defLookup,
Operator[][] useChains,
GrowOnlySet< VariableExpression > history )
{
var exConst = ex as ConstantExpression;
if (exConst != null)
{
if(exConst.IsEqualToZero())
{
return ProveResult.NeverTrue;
}
return ProveResult.AlwaysTrue;
}
var exVar = ex as VariableExpression;
// If we detected a loop, the value may change between iterations.
if(exVar == null || history.Insert( exVar ))
{
return ProveResult.Unknown;
}
//--//
Operator def;
if(defLookup.TryGetValue( exVar, out def ))
{
// If we ever take the address of the expression, assume it can be modified.
foreach (Operator op in useChains[exVar.SpanningTreeIndex])
{
if (op is AddressAssignmentOperator)
{
return ProveResult.Unknown;
}
}
if (def.HasAnnotation< NotNullAnnotation >())
{
return ProveResult.AlwaysTrue;
}
// Phi: If all predecessors are provably the same result, then so is the operator's result.
if(def is PhiOperator)
{
bool isFirstResult = true;
ProveResult result = ProveResult.Unknown;
foreach(Expression rhs in def.Arguments)
{
ProveResult curResult = ProveNonZero( rhs, defLookup, useChains, history );
if(isFirstResult)
{
isFirstResult = false;
result = curResult;
}
else if(curResult != result)
{
// We got two different results from different blocks.
return ProveResult.Unknown;
}
}
return result;
}
// Assignment is transitive, so look up the source value.
if(def is SingleAssignmentOperator)
{
return ProveNonZero( def.FirstArgument, defLookup, useChains, history );
}
#if FUTURE // This block isn't strictly correct and assumes low-level knowledge. We should revisit it.
if(def is BinaryOperator)
{
var binOp = (BinaryOperator)def;
ConstantExpression exConst;
bool fConstOnRight;
var varSrc = binOp.IsBinaryOperationAgainstConstant( out exConst, out fConstOnRight );
if(varSrc != null)
{
//
// Only apply the optimization to pointer-like variables.
//
if(varSrc.CanPointToMemory || exVar.CanPointToMemory)
{
switch(binOp.Alu)
{
case BinaryOperator.ALU.ADD:
case BinaryOperator.ALU.SUB:
//
// Adding/removing a constant from a non-null value doesn't change its nullness.
//
return ProveNonZero( defLookup, history, varSrc );
case BinaryOperator.ALU.OR:
//
// OR'ing with a non-zero constant ensures the results are not null.
//
if(!exConst.IsEqualToZero())
{
return ProveResult.AlwaysTrue;
}
break;
}
}
}
return ProveResult.Unknown;
}
#endif // FUTURE
if(def is PiOperator)
{
var piOp = (PiOperator)def;
ex = def.FirstArgument;
if((piOp.LeftExpression == ex && piOp.RightExpression.IsEqualToZero()) ||
(piOp.RightExpression == ex && piOp.LeftExpression .IsEqualToZero()) )
{
switch(piOp.RelationOperator)
{
case PiOperator.Relation.Equal:
return ProveResult.NeverTrue;
case PiOperator.Relation.NotEqual:
return ProveResult.AlwaysTrue;
}
}
return ProveNonZero( ex, defLookup, useChains, history );
}
}
return ProveResult.Unknown;
}
#if ENABLE_LOW_LEVEL_OPTIMIZATIONS
private static ProveResult ProveComparison(
Transformations.ConstraintSystemCollector cscUpperBound,
Transformations.ConstraintSystemCollector cscLowerBound,
Expression exLeft,
Expression exRight,
ConditionCodeExpression.Comparison condition)
{
switch(condition)
{
case ConditionCodeExpression.Comparison.UnsignedLowerThan:
case ConditionCodeExpression.Comparison.SignedLessThan:
return ProveLessThanOrEqual( cscUpperBound, cscLowerBound, exLeft, exRight, -1 );
case ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame:
case ConditionCodeExpression.Comparison.SignedLessThanOrEqual:
return ProveLessThanOrEqual( cscUpperBound, cscLowerBound, exLeft, exRight, 0 );
case ConditionCodeExpression.Comparison.UnsignedHigherThan:
case ConditionCodeExpression.Comparison.SignedGreaterThan:
return ProveLessThanOrEqual( cscUpperBound, cscLowerBound, exRight, exLeft, -1 );
case ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame:
case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual:
return ProveLessThanOrEqual( cscUpperBound, cscLowerBound, exRight, exLeft, 0 );
}
return ProveResult.Unknown;
}
#endif // ENABLE_LOW_LEVEL_OPTIMIZATIONS
private static ProveResult ProveLessThanOrEqual(
Transformations.ConstraintSystemCollector cscUpperBound,
Transformations.ConstraintSystemCollector cscLowerBound,
Expression exLeft,
Expression exRight,
double weight)
{
if(exLeft is VariableExpression)
{
if(cscUpperBound.Prove( exLeft, exRight, weight ))
{
return ProveResult.AlwaysTrue;
}
}
if(exRight is VariableExpression)
{
if(cscLowerBound.Prove( exRight, exLeft, -weight ))
{
return ProveResult.AlwaysTrue;
}
}
return ProveResult.Unknown;
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
#if ENABLE_LOW_LEVEL_OPTIMIZATIONS
[CompilationSteps.OptimizationHandler(RunOnce=true, RunInSSAForm=true)]
private static void ConvertLongCompareToNormalCompare( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Operator[][] useChains = cfg.DataFlow_UseChains;
foreach(var opLong in cfg.FilterOperators< LongCompareOperator >())
{
Debugging.DebugInfo debugInfo = opLong.DebugInfo;
VariableExpression lhs = opLong.FirstResult;
Expression[] rhs = opLong.Arguments;
Operator[] uses = useChains[lhs.SpanningTreeIndex];
bool fOk = false;
switch(uses.Length)
{
case 0:
fOk = true;
break;
case 1:
{
bool fNullOnRight;
Operator use = uses[0];
Expression[] target = opLong.IsCompareToNull( out fNullOnRight );
ConditionCodeExpression.Comparison cond = ConditionCodeExpression.Comparison.NotValid;
if(use is ConditionalCompareOperator)
{
var ccOp = (ConditionalCompareOperator)use;
cond = ccOp.Condition;
}
else if(use is ConditionCodeConditionalControlOperator)
{
var ccOp = (ConditionCodeConditionalControlOperator)use;
cond = ccOp.Condition;
}
else if(use is SetIfConditionIsTrueOperator)
{
var setOp = (SetIfConditionIsTrueOperator)use;
cond = setOp.Condition;
}
if(cond != ConditionCodeExpression.Comparison.NotValid)
{
ConditionCodeExpression.Comparison condOrig = cond;
Expression rhsLeftLo = rhs[0];
Expression rhsLeftHi = rhs[1];
Expression rhsRightLo = rhs[2];
Expression rhsRightHi = rhs[3];
if(target != null)
{
if(!fNullOnRight)
{
rhsLeftLo = rhs[2];
rhsLeftHi = rhs[3];
rhsRightLo = rhs[0];
rhsRightHi = rhs[1];
cond = ConditionCodeExpression.NegateCondition( cond );
}
//
// We are comparing against zero.
//
// Can we use a single instruction to perform the comparison?
//
// For Zero/NonZero, we just OR together the two halves, and set the condition code.
//
// For Negative/PositiveOrZero, we just need to look at the high part.
//
// For unsigned:
// >= is always true.
// < is always false.
// <= is like Equal.
// > is like NotEqual.
//
//
// For signed:
// >= is like PositiveOrZero.
// < is like Negative.
// <= requires full comparison.
// > requires full comparison.
//
switch(cond)
{
case ConditionCodeExpression.Comparison.Equal :
case ConditionCodeExpression.Comparison.NotEqual:
{
VariableExpression tmp = cfg.AllocatePseudoRegister( rhsLeftLo.Type );
var op2 = BinaryOperatorWithCarryOut.New( debugInfo, BinaryOperator.ALU.OR, false, false, tmp, lhs, rhsLeftLo, rhsLeftHi );
opLong.SubstituteWithOperator( op2, Operator.SubstitutionFlags.Default );
}
fOk = true;
break;
case ConditionCodeExpression.Comparison.Negative :
case ConditionCodeExpression.Comparison.PositiveOrZero :
{
CompareOperator op2 = CompareOperator.New( debugInfo, lhs, rhsLeftHi, nc.TypeSystem.CreateConstant( rhsLeftHi.Type, 0 ) );
opLong.AddOperatorBefore( op2 );
opLong.Delete();
}
fOk = true;
break;
//--//
case ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame:
cond = ConditionCodeExpression.Comparison.Equal;
goto case ConditionCodeExpression.Comparison.Equal;
case ConditionCodeExpression.Comparison.UnsignedHigherThan:
cond = ConditionCodeExpression.Comparison.NotEqual;
goto case ConditionCodeExpression.Comparison.NotEqual;
case ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame:
// Always true.
goto case ConditionCodeExpression.Comparison.PositiveOrZero;
case ConditionCodeExpression.Comparison.UnsignedLowerThan:
// Always false.
goto case ConditionCodeExpression.Comparison.PositiveOrZero;
//--//
case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual:
cond = ConditionCodeExpression.Comparison.PositiveOrZero;
goto case ConditionCodeExpression.Comparison.PositiveOrZero;
case ConditionCodeExpression.Comparison.SignedLessThan:
cond = ConditionCodeExpression.Comparison.Negative;
goto case ConditionCodeExpression.Comparison.Negative;
case ConditionCodeExpression.Comparison.SignedGreaterThan:
case ConditionCodeExpression.Comparison.SignedLessThanOrEqual:
//
// We have to use the full 64bit comparison.
//
break;
}
}
if(fOk == false)
{
//
// We are comparing two variables.
//
// For Zero/NonZero and all the unsigned comparisons,
// first compare the high parts and then compare the low ones, if the high parts are equal.
//
// For signed:
// >= do a subtraction and set the result if SignedGreaterThanOrEqual.
// < do a subtraction and set the result if SignedLessThan.
// <= is like >= with the arguments swapped.
// > is like < with the arguments swapped.
//
switch(cond)
{
case ConditionCodeExpression.Comparison.Equal :
case ConditionCodeExpression.Comparison.NotEqual :
case ConditionCodeExpression.Comparison.UnsignedHigherThanOrSame:
case ConditionCodeExpression.Comparison.UnsignedLowerThan :
case ConditionCodeExpression.Comparison.UnsignedHigherThan :
case ConditionCodeExpression.Comparison.UnsignedLowerThanOrSame :
{
CompareOperator opHigh = CompareOperator.New( debugInfo, lhs, rhsLeftHi, rhsRightHi );
opLong.AddOperatorBefore( opHigh );
ConditionalCompareOperator opLow = ConditionalCompareOperator.New( debugInfo, ConditionCodeExpression.Comparison.Equal, lhs, rhsLeftLo, rhsRightLo, lhs );
opLong.AddOperatorBefore( opLow );
opLong.Delete();
}
fOk = true;
break;
case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual:
{
VariableExpression tmpLo = cfg.AllocatePseudoRegister( rhsLeftLo.Type );
VariableExpression tmpHi = cfg.AllocatePseudoRegister( rhsLeftHi.Type );
var opLow = BinaryOperatorWithCarryOut.New( debugInfo, BinaryOperator.ALU.SUB, true, false, tmpLo, lhs, rhsLeftLo, rhsRightLo );
opLong.AddOperatorBefore( opLow );
var opHigh = BinaryOperatorWithCarryInAndOut.New( debugInfo, BinaryOperator.ALU.SUB, true, false, tmpHi, lhs, rhsLeftHi, rhsRightHi, lhs );
opLong.AddOperatorBefore( opHigh );
opLong.Delete();
cond = ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual;
}
fOk = true;
break;
case ConditionCodeExpression.Comparison.SignedLessThan:
{
VariableExpression tmpLo = cfg.AllocatePseudoRegister( rhsLeftLo.Type );
VariableExpression tmpHi = cfg.AllocatePseudoRegister( rhsLeftHi.Type );
var opLow = BinaryOperatorWithCarryOut.New( debugInfo, BinaryOperator.ALU.SUB, true, false, tmpLo, lhs, rhsLeftLo, rhsRightLo );
opLong.AddOperatorBefore( opLow );
var opHigh = BinaryOperatorWithCarryInAndOut.New( debugInfo, BinaryOperator.ALU.SUB, true, false, tmpHi, lhs, rhsLeftHi, rhsRightHi, lhs );
opLong.AddOperatorBefore( opHigh );
opLong.Delete();
cond = ConditionCodeExpression.Comparison.SignedLessThan;
}
fOk = true;
break;
case ConditionCodeExpression.Comparison.SignedGreaterThan:
{
Expression tmpLo;
Expression tmpHi;
tmpLo = rhsLeftLo ;
tmpHi = rhsLeftHi ;
rhsLeftLo = rhsRightLo;
rhsLeftHi = rhsRightHi;
rhsRightLo = tmpLo ;
rhsRightHi = tmpHi ;
goto case ConditionCodeExpression.Comparison.SignedLessThan;
}
case ConditionCodeExpression.Comparison.SignedLessThanOrEqual:
{
Expression tmpLo;
Expression tmpHi;
tmpLo = rhsLeftLo ;
tmpHi = rhsLeftHi ;
rhsLeftLo = rhsRightLo;
rhsLeftHi = rhsRightHi;
rhsRightLo = tmpLo ;
rhsRightHi = tmpHi ;
goto case ConditionCodeExpression.Comparison.SignedGreaterThanOrEqual;
}
}
}
if(condOrig != cond)
{
if(use is ConditionalCompareOperator)
{
var ccOp = (ConditionalCompareOperator)use;
ccOp.Condition = cond;
}
else if(use is ConditionCodeConditionalControlOperator)
{
var ccOp = (ConditionCodeConditionalControlOperator)use;
ccOp.Condition = cond;
}
else if(use is SetIfConditionIsTrueOperator)
{
var setOp = (SetIfConditionIsTrueOperator)use;
setOp.Condition = cond;
}
}
}
}
break;
default:
throw TypeConsistencyErrorException.Create( "Unexpected form of '{0}' with multiple uses for the condition code", opLong );
}
if(fOk == false)
{
throw TypeConsistencyErrorException.Create( "Unexpected form of '{0}'", opLong );
}
}
}
#endif // ENABLE_LOW_LEVEL_OPTIMIZATIONS
#if ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true, RunInSSAForm = true)]
#else // ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true)]
#endif // ALLOW_SSA_FORM
private static void ReduceComparisons(PhaseExecution.NotificationContext nc)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Operator[][] defChains = cfg.DataFlow_DefinitionChains;
Operator[][] useChains = cfg.DataFlow_UseChains;
// Replace split compare + branch operators with CompareConditionalControlOperator.
foreach (var branchOp in cfg.FilterOperators())
{
var comparand = branchOp.FirstArgument as VariableExpression;
if (comparand == null)
{
continue;
}
var compareOp = ControlFlowGraphState.CheckSingleDefinition(defChains, comparand) as CompareAndSetOperator;
if (compareOp == null)
{
continue;
}
var conditionalOp = CompareConditionalControlOperator.New(
branchOp.DebugInfo,
compareOp.Condition,
compareOp.Signed,
compareOp.FirstArgument,
compareOp.SecondArgument,
branchOp.TargetBranchNotTaken,
branchOp.TargetBranchTaken);
branchOp.SubstituteWithOperator(conditionalOp, Operator.SubstitutionFlags.Default);
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
#if ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true, RunInSSAForm = true)]
#else // ALLOW_SSA_FORM
[CompilationSteps.OptimizationHandler(RunOnce = true)]
#endif // ALLOW_SSA_FORM
private static void RemoveRedundantConversions( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Operator[][] defChains = cfg.DataFlow_DefinitionChains;
Operator[][] useChains = cfg.DataFlow_UseChains;
cfg.ResetCacheCheckpoint( );
foreach(var opConv in cfg.FilterOperators< ConversionOperator >())
{
var lhs = opConv.FirstResult;
var rhs = opConv.FirstArgument;
if(rhs is VariableExpression)
{
var def = ControlFlowGraphState.CheckSingleDefinition( defChains, (VariableExpression)rhs );
bool fSubstitute = false;
var defLoad = def as LoadIndirectOperator;
if(defLoad != null)
{
TypeRepresentation tdSrc = defLoad.Type;
if(tdSrc.SizeOfHoldingVariable == opConv.SignificantSize)
{
if((opConv is ZeroExtendOperator && tdSrc.IsSigned == false) ||
(opConv is SignExtendOperator && tdSrc.IsSigned == true ) )
{
fSubstitute = true;
}
}
}
else if(def is BinaryOperator)
{
var defBinOp = (BinaryOperator)def;
switch(defBinOp.Alu)
{
case BinaryOperator.ALU.AND:
defBinOp.EnsureConstantToTheRight();
var ex = defBinOp.SecondArgument as ConstantExpression;
ulong val;
if(ex != null && ex.GetAsUnsignedInteger( out val ) && val != 0)
{
int msb = BitVector.GetPositionOfLastBitSet( val );
uint max = opConv.SignificantSize * 8;
//
// Masking by a constant smaller than the destination size.
//
if((opConv is ZeroExtendOperator && (msb < max )) ||
(opConv is SignExtendOperator && (msb < max - 1)) )
{
fSubstitute = true;
}
}
break;
}
}
if(fSubstitute)
{
foreach(Operator use in useChains[lhs.SpanningTreeIndex])
{
use.SubstituteUsage( lhs, rhs );
}
}
}
foreach(Operator use in useChains[lhs.SpanningTreeIndex])
{
var useStore = use as StoreIndirectOperator;
if(useStore != null)
{
if(opConv.SignificantSize >= useStore.Type.SizeOfHoldingVariable)
{
use.SubstituteUsage( lhs, rhs );
}
}
}
}
cfg.AssertNoCacheRefreshSinceCheckpoint( );
}
#if ENABLE_LOW_LEVEL_OPTIMIZATIONS
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.OptimizationHandler(RunOnce = false, RunInSSAForm = true)]
private static void ConstantMemoryDereference( PhaseExecution.NotificationContext nc )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
foreach(var opLoad in cfg.FilterOperators< LoadIndirectOperator >())
{
var debugInfo = opLoad.DebugInfo;
var lhs = opLoad.FirstResult;
var rhs = opLoad.FirstArgument as ConstantExpression;
if(rhs != null)
{
var dd = rhs.Value as DataManager.DataDescriptor;
if(dd != null)
{
var val2 = dd.GetDataAtOffset( opLoad.AccessPath, 0, opLoad.Offset );
var ddVal = val2 as DataManager.DataDescriptor;
if(ddVal != null && ddVal.CanPropagate)
{
opLoad.SubstituteWithOperator( SingleAssignmentOperator.New( debugInfo, lhs, ts.CreateConstant( lhs.Type, val2 ) ), Operator.SubstitutionFlags.Default );
continue;
}
}
}
}
}
#endif // ENABLE_LOW_LEVEL_OPTIMIZATIONS
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/ProtectRequiredEntities.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class ProtectRequiredEntities
{
[CompilationSteps.CallClosureHandler( typeof(InstanceCallOperator) )]
private static void Protect_MethodPointers( ComputeCallsClosure.Context host ,
Operator target )
{
InstanceCallOperator call = (InstanceCallOperator)target;
if(call.CallType == CallOperator.CallKind.Virtual)
{
Keep_VTablesGetter ( host );
Keep_VTables ( host );
Keep_MethodPointers( host );
}
if(call.TargetMethod is InstanceMethodRepresentation)
{
Keep_NullCheck( host );
}
if(call.TargetMethod.OwnerType is InterfaceTypeRepresentation)
{
Keep_InterfaceMap( host );
}
}
[CompilationSteps.CallClosureHandler( typeof(FieldOperator))]
private static void Protect_FieldOperator( ComputeCallsClosure.Context host ,
Operator target )
{
Keep_NullCheck( host );
}
[CompilationSteps.CallClosureHandler( typeof(ElementOperator) )]
private static void Protect_ElementOperator( ComputeCallsClosure.Context host ,
Operator target )
{
Keep_NullCheck ( host );
Keep_BoundCheck( host );
Keep_ArraySize ( host );
}
[CompilationSteps.CallClosureHandler( typeof(BinaryOperator) )]
[CompilationSteps.CallClosureHandler( typeof(SignExtendOperator) )]
[CompilationSteps.CallClosureHandler( typeof(TruncateOperator) )]
[CompilationSteps.CallClosureHandler( typeof(UnaryOperator) )]
[CompilationSteps.CallClosureHandler( typeof(ZeroExtendOperator) )]
private static void Protect_OverflowOperators( ComputeCallsClosure.Context host ,
Operator target )
{
Keep_OverflowCheck( host );
}
[CompilationSteps.CallClosureHandler( typeof(BinaryOperator) )]
private static void Protect_BinaryOperator( ComputeCallsClosure.Context host ,
Operator target )
{
BinaryOperator op = (BinaryOperator)target;
TypeRepresentation td = op.FirstArgument.Type;
TypeSystemForCodeTransformation ts = host.TypeSystem;
WellKnownTypes wkt = ts.WellKnownTypes;
WellKnownMethods wkm = ts.WellKnownMethods;
if(td == wkt.System_Int32 ||
td == wkt.System_UInt32 )
{
if(op.Signed)
{
switch(op.Alu)
{
case BinaryOperator.ALU.DIV: host.CoverObject( wkm.Helpers_BinaryOperations_IntDiv ); break;
case BinaryOperator.ALU.REM: host.CoverObject( wkm.Helpers_BinaryOperations_IntRem ); break;
}
}
else
{
switch(op.Alu)
{
case BinaryOperator.ALU.DIV: host.CoverObject( wkm.Helpers_BinaryOperations_UintDiv ); break;
case BinaryOperator.ALU.REM: host.CoverObject( wkm.Helpers_BinaryOperations_UintRem ); break;
}
}
}
else if(td == wkt.System_Int64 ||
td == wkt.System_UInt64 )
{
if(op.Signed)
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL: host.CoverObject( wkm.Helpers_BinaryOperations_LongMul ); break;
case BinaryOperator.ALU.DIV: host.CoverObject( wkm.Helpers_BinaryOperations_LongDiv ); break;
case BinaryOperator.ALU.REM: host.CoverObject( wkm.Helpers_BinaryOperations_LongRem ); break;
case BinaryOperator.ALU.SHL: host.CoverObject( wkm.Helpers_BinaryOperations_LongShl ); break;
case BinaryOperator.ALU.SHR: host.CoverObject( wkm.Helpers_BinaryOperations_LongShr ); break;
}
}
else
{
switch(op.Alu)
{
case BinaryOperator.ALU.MUL: host.CoverObject( wkm.Helpers_BinaryOperations_UlongMul ); break;
case BinaryOperator.ALU.DIV: host.CoverObject( wkm.Helpers_BinaryOperations_UlongDiv ); break;
case BinaryOperator.ALU.REM: host.CoverObject( wkm.Helpers_BinaryOperations_UlongRem ); break;
case BinaryOperator.ALU.SHL: host.CoverObject( wkm.Helpers_BinaryOperations_UlongShl ); break;
case BinaryOperator.ALU.SHR: host.CoverObject( wkm.Helpers_BinaryOperations_UlongShr ); break;
}
}
}
}
[CompilationSteps.CallClosureHandler(typeof(CallOperator))]
private static void Protect_ExceptionOperators(ComputeCallsClosure.Context host, Operator target)
{
// Don't cover unprotected calls.
if (target.BasicBlock.ProtectedBy.Length == 0)
{
return;
}
TypeRepresentation resultType = host.TypeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_LandingPadResult;
host.CoverObject(resultType);
foreach (var field in resultType.Fields)
{
host.CoverObject(field);
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
private static void Keep_VTablesGetter( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownMethods.VTable_Get );
}
private static void Keep_VTables( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownFields.ObjectHeader_VirtualTable );
}
private static void Keep_MethodPointers( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownFields.VTable_MethodPointers );
host.CoverObject( host.TypeSystem.WellKnownFields.CodePointer_Target );
}
private static void Keep_InterfaceMap( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownMethods.VTable_GetInterface );
}
private static void Keep_ArraySize( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownFields.ArrayImpl_m_numElements );
}
private static void Keep_NullCheck( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownMethods.ThreadImpl_ThrowNullException );
}
private static void Keep_BoundCheck( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownMethods.ThreadImpl_ThrowIndexOutOfRangeException );
}
private static void Keep_OverflowCheck( ComputeCallsClosure.Context host )
{
host.CoverObject( host.TypeSystem.WellKnownMethods.ThreadImpl_ThrowOverflowException );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/SoftwareFloatingPoint.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class SoftwareFloatingPoint
{
const string c_CompareAndSet_FloatEqual = "SoftFP_CompareAndSet_FloatEqual";
const string c_CompareAndSet_FloatGreaterOrEqual = "SoftFP_CompareAndSet_FloatGreaterOrEqual";
const string c_CompareAndSet_FloatGreater = "SoftFP_CompareAndSet_FloatGreater";
const string c_CompareAndSet_FloatLessOrEqual = "SoftFP_CompareAndSet_FloatLessOrEqual";
const string c_CompareAndSet_FloatLess = "SoftFP_CompareAndSet_FloatLess";
const string c_CompareAndSet_FloatNotEqual = "SoftFP_CompareAndSet_FloatNotEqual";
const string c_CompareAndSet_DoubleEqual = "SoftFP_CompareAndSet_DoubleEqual";
const string c_CompareAndSet_DoubleGreaterOrEqual = "SoftFP_CompareAndSet_DoubleGreaterOrEqual";
const string c_CompareAndSet_DoubleGreater = "SoftFP_CompareAndSet_DoubleGreater";
const string c_CompareAndSet_DoubleLessOrEqual = "SoftFP_CompareAndSet_DoubleLessOrEqual";
const string c_CompareAndSet_DoubleLess = "SoftFP_CompareAndSet_DoubleLess";
const string c_CompareAndSet_DoubleNotEqual = "SoftFP_CompareAndSet_DoubleNotEqual";
//--//
const string c_BinaryOperations_FloatAdd = "SoftFP_BinaryOperations_FloatAdd";
const string c_BinaryOperations_FloatSub = "SoftFP_BinaryOperations_FloatSub";
const string c_BinaryOperations_FloatMul = "SoftFP_BinaryOperations_FloatMul";
const string c_BinaryOperations_FloatDiv = "SoftFP_BinaryOperations_FloatDiv";
const string c_BinaryOperations_FloatRem = "SoftFP_BinaryOperations_FloatRem";
const string c_BinaryOperations_DoubleAdd = "SoftFP_BinaryOperations_DoubleAdd";
const string c_BinaryOperations_DoubleSub = "SoftFP_BinaryOperations_DoubleSub";
const string c_BinaryOperations_DoubleMul = "SoftFP_BinaryOperations_DoubleMul";
const string c_BinaryOperations_DoubleDiv = "SoftFP_BinaryOperations_DoubleDiv";
const string c_BinaryOperations_DoubleRem = "SoftFP_BinaryOperations_DoubleRem";
//--//
const string c_UnaryOperations_FloatNeg = "SoftFP_UnaryOperations_FloatNeg";
const string c_UnaryOperations_FloatFinite = "SoftFP_UnaryOperations_FloatFinite";
const string c_UnaryOperations_DoubleNeg = "SoftFP_UnaryOperations_DoubleNeg";
const string c_UnaryOperations_DoubleFinite = "SoftFP_UnaryOperations_DoubleFinite";
//--//
const string c_Convert_IntToFloat = "SoftFP_Convert_IntToFloat";
const string c_Convert_LongToFloat = "SoftFP_Convert_LongToFloat";
const string c_Convert_UnsignedIntToFloat = "SoftFP_Convert_UnsignedIntToFloat";
const string c_Convert_UnsignedLongToFloat = "SoftFP_Convert_UnsignedLongToFloat";
const string c_Convert_DoubleToFloat = "SoftFP_Convert_DoubleToFloat";
const string c_Convert_IntToDouble = "SoftFP_Convert_IntToDouble";
const string c_Convert_LongToDouble = "SoftFP_Convert_LongToDouble";
const string c_Convert_UnsignedIntToDouble = "SoftFP_Convert_UnsignedIntToDouble";
const string c_Convert_UnsignedLongToDouble = "SoftFP_Convert_UnsignedLongToDouble";
const string c_Convert_FloatToDouble = "SoftFP_Convert_FloatToDouble";
const string c_Convert_FloatToInt = "SoftFP_Convert_FloatToInt";
const string c_Convert_FloatToUnsignedInt = "SoftFP_Convert_FloatToUnsignedInt";
const string c_Convert_DoubleToInt = "SoftFP_Convert_DoubleToInt";
const string c_Convert_DoubleToUnsignedInt = "SoftFP_Convert_DoubleToUnsignedInt";
const string c_Convert_FloatToLong = "SoftFP_Convert_FloatToLong";
const string c_Convert_FloatToUnsignedLong = "SoftFP_Convert_FloatToUnsignedLong";
const string c_Convert_DoubleToLong = "SoftFP_Convert_DoubleToLong";
const string c_Convert_DoubleToUnsignedLong = "SoftFP_Convert_DoubleToUnsignedLong";
//--//
[CompilationSteps.CallClosureHandler( typeof(CompareConditionalControlOperator) )]
private static void Protect_CompareConditionalControlOperator( ComputeCallsClosure.Context host ,
Operator target )
{
CompareConditionalControlOperator op = (CompareConditionalControlOperator)target;
Protect_CommonFloatingPointCompare( host, op, op.Condition );
}
[CompilationSteps.CallClosureHandler( typeof(CompareAndSetOperator) )]
private static void Protect_CompareAndSetOperators( ComputeCallsClosure.Context host ,
Operator target )
{
CompareAndSetOperator op = (CompareAndSetOperator)target;
Protect_CommonFloatingPointCompare( host, op, op.Condition );
}
private static void Protect_CommonFloatingPointCompare( ComputeCallsClosure.Context host ,
Operator target ,
CompareAndSetOperator.ActionCondition condition )
{
TypeRepresentation td = target.FirstArgument.Type;
TypeSystemForCodeTransformation ts = host.TypeSystem;
WellKnownTypes wkt = ts.WellKnownTypes;
string name = null;
if(td == wkt.System_Single)
{
switch(condition)
{
case CompareAndSetOperator.ActionCondition.EQ: name = c_CompareAndSet_FloatEqual ; break;
case CompareAndSetOperator.ActionCondition.GE: name = c_CompareAndSet_FloatGreaterOrEqual; break;
case CompareAndSetOperator.ActionCondition.GT: name = c_CompareAndSet_FloatGreater ; break;
case CompareAndSetOperator.ActionCondition.LE: name = c_CompareAndSet_FloatLessOrEqual ; break;
case CompareAndSetOperator.ActionCondition.LT: name = c_CompareAndSet_FloatLess ; break;
case CompareAndSetOperator.ActionCondition.NE: name = c_CompareAndSet_FloatNotEqual ; break;
}
}
else if(td == wkt.System_Double)
{
switch(condition)
{
case CompareAndSetOperator.ActionCondition.EQ: name = c_CompareAndSet_DoubleEqual ; break;
case CompareAndSetOperator.ActionCondition.GE: name = c_CompareAndSet_DoubleGreaterOrEqual; break;
case CompareAndSetOperator.ActionCondition.GT: name = c_CompareAndSet_DoubleGreater ; break;
case CompareAndSetOperator.ActionCondition.LE: name = c_CompareAndSet_DoubleLessOrEqual ; break;
case CompareAndSetOperator.ActionCondition.LT: name = c_CompareAndSet_DoubleLess ; break;
case CompareAndSetOperator.ActionCondition.NE: name = c_CompareAndSet_DoubleNotEqual ; break;
}
}
if(name != null)
{
host.CoverObject( ts.GetWellKnownMethod( name ) );
}
}
[CompilationSteps.CallClosureHandler( typeof(BinaryOperator) )]
private static void Protect_BinaryOperator( ComputeCallsClosure.Context host ,
Operator target )
{
BinaryOperator op = (BinaryOperator)target;
TypeRepresentation td = op.FirstArgument.Type;
TypeSystemForCodeTransformation ts = host.TypeSystem;
WellKnownTypes wkt = ts.WellKnownTypes;
string name = null;
if(td == wkt.System_Single)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD: name = c_BinaryOperations_FloatAdd; break;
case BinaryOperator.ALU.SUB: name = c_BinaryOperations_FloatSub; break;
case BinaryOperator.ALU.MUL: name = c_BinaryOperations_FloatMul; break;
case BinaryOperator.ALU.DIV: name = c_BinaryOperations_FloatDiv; break;
case BinaryOperator.ALU.REM: name = c_BinaryOperations_FloatRem; break;
}
}
else if(td == wkt.System_Double)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD: name = c_BinaryOperations_DoubleAdd; break;
case BinaryOperator.ALU.SUB: name = c_BinaryOperations_DoubleSub; break;
case BinaryOperator.ALU.MUL: name = c_BinaryOperations_DoubleMul; break;
case BinaryOperator.ALU.DIV: name = c_BinaryOperations_DoubleDiv; break;
case BinaryOperator.ALU.REM: name = c_BinaryOperations_DoubleRem; break;
}
}
if(name != null)
{
host.CoverObject( ts.GetWellKnownMethod( name ) );
}
}
[CompilationSteps.CallClosureHandler( typeof(UnaryOperator) )]
private static void Protect_UnaryOperator( ComputeCallsClosure.Context host ,
Operator target )
{
UnaryOperator op = (UnaryOperator)target;
TypeRepresentation td = op.FirstArgument.Type;
TypeSystemForCodeTransformation ts = host.TypeSystem;
WellKnownTypes wkt = ts.WellKnownTypes;
string name = null;
if(td == wkt.System_Single)
{
switch(op.Alu)
{
case UnaryOperator.ALU.NEG : name = c_UnaryOperations_FloatNeg ; break;
case UnaryOperator.ALU.FINITE: name = c_UnaryOperations_FloatFinite; break;
}
}
else if(td == wkt.System_Double)
{
switch(op.Alu)
{
case UnaryOperator.ALU.NEG : name = c_UnaryOperations_DoubleNeg ; break;
case UnaryOperator.ALU.FINITE: name = c_UnaryOperations_DoubleFinite; break;
}
}
if(name != null)
{
host.CoverObject( ts.GetWellKnownMethod( name ) );
}
}
[CompilationSteps.CallClosureHandler( typeof(ConvertOperator) )]
private static void Protect_ConvertOperator( ComputeCallsClosure.Context host ,
Operator target )
{
ConvertOperator op = (ConvertOperator)target;
TypeSystemForCodeTransformation ts = host.TypeSystem;
TypeRepresentation.BuiltInTypes kindInput = op.InputKind;
TypeRepresentation.BuiltInTypes kindOutput = op.OutputKind;
string name = null;
switch(kindOutput)
{
case TypeRepresentation.BuiltInTypes.R4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.I4: name = c_Convert_IntToFloat ; break;
case TypeRepresentation.BuiltInTypes.U4: name = c_Convert_UnsignedIntToFloat ; break;
case TypeRepresentation.BuiltInTypes.I8: name = c_Convert_LongToFloat ; break;
case TypeRepresentation.BuiltInTypes.U8: name = c_Convert_UnsignedLongToFloat; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToFloat ; break;
}
break;
case TypeRepresentation.BuiltInTypes.R8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.I4: name = c_Convert_IntToDouble ; break;
case TypeRepresentation.BuiltInTypes.U4: name = c_Convert_UnsignedIntToDouble ; break;
case TypeRepresentation.BuiltInTypes.I8: name = c_Convert_LongToDouble ; break;
case TypeRepresentation.BuiltInTypes.U8: name = c_Convert_UnsignedLongToDouble; break;
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToDouble ; break;
}
break;
case TypeRepresentation.BuiltInTypes.I4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToInt ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToInt; break;
}
break;
case TypeRepresentation.BuiltInTypes.U4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToUnsignedInt ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToUnsignedInt; break;
}
break;
case TypeRepresentation.BuiltInTypes.I8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToLong ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToLong; break;
}
break;
case TypeRepresentation.BuiltInTypes.U8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToUnsignedLong ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToUnsignedLong; break;
}
break;
}
if(name != null)
{
host.CoverObject( ts.GetWellKnownMethod( name ) );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(CompareConditionalControlOperator) )]
private static void Handle_CompareConditionalControlOperator( PhaseExecution.NotificationContext nc )
{
CompareConditionalControlOperator op = (CompareConditionalControlOperator)nc.CurrentOperator;
if(op.FirstArgument.Type.IsFloatingPoint)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
TemporaryVariableExpression tmp = cfg.AllocateTemporary( ts.WellKnownTypes.System_Boolean, null );
CompareAndSetOperator opCmp = CompareAndSetOperator.New( op.DebugInfo, op.Condition, op.Signed, tmp, op.FirstArgument, op.SecondArgument );
op.AddOperatorBefore( opCmp );
BinaryConditionalControlOperator opCtrl = BinaryConditionalControlOperator.New( op.DebugInfo, tmp, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opCtrl, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(CompareAndSetOperator) )]
private static void Handle_CompareAndSetOperator( PhaseExecution.NotificationContext nc )
{
CompareAndSetOperator op = (CompareAndSetOperator)nc.CurrentOperator;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
if(tdSrc1.IsFloatingPoint &&
tdSrc2.IsFloatingPoint )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
string name;
CHECKS.ASSERT( sizeSrc1 == sizeSrc2, "Cannot compare entities of different size: {0} <=> {1}", exSrc1, exSrc2 );
if(sizeSrc1 == 1)
{
switch(op.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ: name = c_CompareAndSet_FloatEqual ; break;
case CompareAndSetOperator.ActionCondition.GE: name = c_CompareAndSet_FloatGreaterOrEqual; break;
case CompareAndSetOperator.ActionCondition.GT: name = c_CompareAndSet_FloatGreater ; break;
case CompareAndSetOperator.ActionCondition.LE: name = c_CompareAndSet_FloatLessOrEqual ; break;
case CompareAndSetOperator.ActionCondition.LT: name = c_CompareAndSet_FloatLess ; break;
case CompareAndSetOperator.ActionCondition.NE: name = c_CompareAndSet_FloatNotEqual ; break;
default: throw TypeConsistencyErrorException.Create( "Unexpected value {0} in {1}", op.Condition, op );
}
}
else if(sizeSrc1 == 2)
{
switch(op.Condition)
{
case CompareAndSetOperator.ActionCondition.EQ: name = c_CompareAndSet_DoubleEqual ; break;
case CompareAndSetOperator.ActionCondition.GE: name = c_CompareAndSet_DoubleGreaterOrEqual; break;
case CompareAndSetOperator.ActionCondition.GT: name = c_CompareAndSet_DoubleGreater ; break;
case CompareAndSetOperator.ActionCondition.LE: name = c_CompareAndSet_DoubleLessOrEqual ; break;
case CompareAndSetOperator.ActionCondition.LT: name = c_CompareAndSet_DoubleLess ; break;
case CompareAndSetOperator.ActionCondition.NE: name = c_CompareAndSet_DoubleNotEqual ; break;
default: throw TypeConsistencyErrorException.Create( "Unexpected value {0} in {1}", op.Condition, op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported compare operation larger than 64 bits: {0}", op );
}
ts.SubstituteWithCallToHelper( name, op );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(BinaryOperator) )]
private static void Handle_BinaryOperator( PhaseExecution.NotificationContext nc )
{
BinaryOperator op = (BinaryOperator)nc.CurrentOperator;
Expression exSrc1 = op.FirstArgument;
Expression exSrc2 = op.SecondArgument;
TypeRepresentation tdSrc1 = exSrc1.Type;
TypeRepresentation tdSrc2 = exSrc2.Type;
if(tdSrc1.IsFloatingPoint &&
tdSrc2.IsFloatingPoint )
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
VariableExpression exRes = op.FirstResult;
TypeRepresentation tdRes = exRes .Type;
uint sizeRes = tdRes .SizeOfHoldingVariableInWords;
uint sizeSrc1 = tdSrc1.SizeOfHoldingVariableInWords;
uint sizeSrc2 = tdSrc2.SizeOfHoldingVariableInWords;
string name;
CHECKS.ASSERT( sizeSrc1 == sizeSrc2, "Cannot compare entities of different size: {0} <=> {1}", exSrc1, exSrc2 );
if(sizeSrc1 == 1)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD: name = c_BinaryOperations_FloatAdd; break;
case BinaryOperator.ALU.SUB: name = c_BinaryOperations_FloatSub; break;
case BinaryOperator.ALU.MUL: name = c_BinaryOperations_FloatMul; break;
case BinaryOperator.ALU.DIV: name = c_BinaryOperations_FloatDiv; break;
case BinaryOperator.ALU.REM: name = c_BinaryOperations_FloatRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else if(sizeSrc1 == 2)
{
switch(op.Alu)
{
case BinaryOperator.ALU.ADD: name = c_BinaryOperations_DoubleAdd; break;
case BinaryOperator.ALU.SUB: name = c_BinaryOperations_DoubleSub; break;
case BinaryOperator.ALU.MUL: name = c_BinaryOperations_DoubleMul; break;
case BinaryOperator.ALU.DIV: name = c_BinaryOperations_DoubleDiv; break;
case BinaryOperator.ALU.REM: name = c_BinaryOperations_DoubleRem; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for binary operator: {0}", op );
}
ts.SubstituteWithCallToHelper( name, op );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(UnaryOperator) )]
private static void Handle_UnaryOperator( PhaseExecution.NotificationContext nc )
{
UnaryOperator op = (UnaryOperator)nc.CurrentOperator;
Expression exSrc = op.FirstArgument;
TypeRepresentation tdSrc = exSrc.Type;
if(tdSrc.IsFloatingPoint)
{
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
uint sizeSrc = tdSrc.SizeOfHoldingVariableInWords;
string name;
if(sizeSrc == 1)
{
switch(op.Alu)
{
case UnaryOperator.ALU.NEG : name = c_UnaryOperations_FloatNeg ; break;
case UnaryOperator.ALU.FINITE: name = c_UnaryOperations_FloatFinite; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
}
else if(sizeSrc == 2)
{
switch(op.Alu)
{
case UnaryOperator.ALU.NEG : name = c_UnaryOperations_DoubleNeg ; break;
case UnaryOperator.ALU.FINITE: name = c_UnaryOperations_DoubleFinite; break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for unary operator: {0}", op );
}
ts.SubstituteWithCallToHelper( name, op );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(BinaryConditionalControlOperator) )]
private static void Handle_BinaryConditionalControlOperator( PhaseExecution.NotificationContext nc )
{
BinaryConditionalControlOperator op = (BinaryConditionalControlOperator)nc.CurrentOperator;
Expression exSrc = op.FirstArgument;
TypeRepresentation tdSrc = exSrc.Type;
//--//
if(tdSrc.IsFloatingPoint)
{
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
Debugging.DebugInfo debugInfo = op.DebugInfo;
uint sizeSrc = tdSrc.SizeOfHoldingVariableInWords;
string name;
object val;
if(sizeSrc == 1)
{
name = c_CompareAndSet_FloatEqual;
val = (float)0;
}
else if(sizeSrc == 2)
{
name = c_CompareAndSet_DoubleEqual;
val = (double)0;
}
else
{
throw TypeConsistencyErrorException.Create( "Unsupported inputs for compare: {0}", op );
}
MethodRepresentation md = ts.GetWellKnownMethod( name );
VariableExpression tmpFragment = cfg.AllocatePseudoRegister( ts.WellKnownTypes.System_Boolean );
Expression[] rhs = ts.AddTypePointerToArgumentsOfStaticMethod( md, op.FirstArgument, ts.CreateConstant( md.OwnerType, val ) );
StaticCallOperator opCall = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, VariableExpression.ToArray( tmpFragment ), rhs );
op.AddOperatorBefore( opCall );
//--//
var cc = cfg.AllocateConditionCode();
op.AddOperatorBefore( CompareOperator.New( debugInfo, cc, tmpFragment, ts.CreateConstant( 0 ) ) );
ConditionCodeConditionalControlOperator opNew = ConditionCodeConditionalControlOperator.New( debugInfo, ConditionCodeExpression.Comparison.NotEqual, cc, op.TargetBranchNotTaken, op.TargetBranchTaken );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.OperatorHandler( typeof(ConvertOperator) )]
private static void Handle_ConvertOperator_Exceptions( PhaseExecution.NotificationContext nc )
{
ConvertOperator op = (ConvertOperator)nc.CurrentOperator;
VariableExpression lhs = op.FirstResult;
Expression rhs = op.FirstArgument;
if(op.CheckOverflow)
{
ConvertOperator opNew = ConvertOperator.New( op.DebugInfo, op.InputKind, op.OutputKind, false, lhs, rhs );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.CopyAnnotations );
//
// BUGBUG: We are dropping the overflow check!!
//
//// CreateOverflowCheck( nc, op, opNew );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ConvertUnsupportedOperatorsToMethodCalls) )]
[CompilationSteps.OperatorHandler( typeof(ConvertOperator) )]
private static void Handle_ConvertOperator( PhaseExecution.NotificationContext nc )
{
ConvertOperator op = (ConvertOperator)nc.CurrentOperator;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
TypeRepresentation.BuiltInTypes kindInput = op.InputKind;
TypeRepresentation.BuiltInTypes kindOutput = op.OutputKind;
string name = null;
switch(kindOutput)
{
case TypeRepresentation.BuiltInTypes.R4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.I4: name = c_Convert_IntToFloat ; break;
case TypeRepresentation.BuiltInTypes.U4: name = c_Convert_UnsignedIntToFloat ; break;
case TypeRepresentation.BuiltInTypes.I8: name = c_Convert_LongToFloat ; break;
case TypeRepresentation.BuiltInTypes.U8: name = c_Convert_UnsignedLongToFloat; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToFloat ; break;
}
break;
case TypeRepresentation.BuiltInTypes.R8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.I4: name = c_Convert_IntToDouble ; break;
case TypeRepresentation.BuiltInTypes.U4: name = c_Convert_UnsignedIntToDouble ; break;
case TypeRepresentation.BuiltInTypes.I8: name = c_Convert_LongToDouble ; break;
case TypeRepresentation.BuiltInTypes.U8: name = c_Convert_UnsignedLongToDouble; break;
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToDouble ; break;
}
break;
case TypeRepresentation.BuiltInTypes.I4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToInt ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToInt; break;
}
break;
case TypeRepresentation.BuiltInTypes.U4:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToUnsignedInt ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToUnsignedInt; break;
}
break;
case TypeRepresentation.BuiltInTypes.I8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToLong ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToLong; break;
}
break;
case TypeRepresentation.BuiltInTypes.U8:
switch(kindInput)
{
case TypeRepresentation.BuiltInTypes.R4: name = c_Convert_FloatToUnsignedLong ; break;
case TypeRepresentation.BuiltInTypes.R8: name = c_Convert_DoubleToUnsignedLong; break;
}
break;
}
if(name != null)
{
MethodRepresentation md = ts.GetWellKnownMethod( name );
Expression[] rhs = ts.AddTypePointerToArgumentsOfStaticMethod( md, op.FirstArgument, ts.CreateConstant( ts.WellKnownTypes.System_Boolean, op.CheckOverflow ) );
StaticCallOperator opCall = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, op.Results, rhs );
op.SubstituteWithOperator( opCall, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/WellKnownFieldHandlers.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class WellKnownFieldHandlers
{
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.PostPhaseHandler]
private static void Handle_ResourceManagerImpl_s_resources( PhaseDriver host ,
TypeSystemForCodeTransformation typeSystem )
{
//
// Only generate the table if the corresponding field is referenced by the application.
// We can detect that by checking the "ImplementedBy" property of a static field:
// it will be valid if there's an operator involving the field.
//
var fd = (StaticFieldRepresentation)typeSystem.WellKnownFields.ResourceManagerImpl_s_resources;
if(fd != null)
{
InstanceFieldRepresentation fdReal = fd.ImplementedBy;
if(fdReal != null)
{
DataManager.ObjectDescriptor od = typeSystem.GetGlobalRoot();
if(od.Get( fdReal ) == null) // Create only once.
{
od.ConvertAndSet( fdReal, DataManager.Attributes.Constant | DataManager.Attributes.SuitableForConstantPropagation, null, typeSystem.Resources.ToArray() );
}
}
}
}
[CompilationSteps.PhaseFilter( typeof(Phases.ReduceTypeSystem) )]
[CompilationSteps.PostPhaseHandler]
private static void Handle_GarbageCollectionManager_m_extensionTargets( PhaseDriver host ,
TypeSystemForCodeTransformation typeSystem )
{
//
// Only generate the table if the corresponding field is referenced by the application.
// We can detect that by checking the "ImplementedBy" property of a static field:
// it will be valid if there's an operator involving the field.
//
var fd = (InstanceFieldRepresentation)typeSystem.WellKnownFields.GarbageCollectionManager_m_extensionTargets;
if(fd != null)
{
TypeRepresentation td = fd.OwnerType;
TypeRepresentation tdNew;
if(typeSystem.ForcedDevirtualizations.TryGetValue( td, out tdNew ) == false)
{
throw TypeConsistencyErrorException.Create( "Cannot devirtualize type '{0}'", td );
}
var od = typeSystem.GenerateSingleton( tdNew, DataManager.Attributes.Constant | DataManager.Attributes.SuitableForConstantPropagation );
if(od.Get( fd ) == null)
{
var extensions = typeSystem.GarbageCollectionExtensions;
var vTables = new VTable[extensions.Count];
int pos = 0;
foreach(var tdSrc in extensions.Keys)
{
vTables[pos++] = tdSrc.VirtualTable;
}
od.ConvertAndSet( fd, DataManager.Attributes.Constant, null, vTables );
}
}
}
[CompilationSteps.PhaseFilter( typeof(Phases.ReduceTypeSystem) )]
[CompilationSteps.PostPhaseHandler]
private static void Handle_GarbageCollectionManager_m_extensionHandlers( PhaseDriver host ,
TypeSystemForCodeTransformation typeSystem )
{
//
// Only generate the table if the corresponding field is referenced by the application.
// We can detect that by checking the "ImplementedBy" property of a static field:
// it will be valid if there's an operator involving the field.
//
var fd = (InstanceFieldRepresentation)typeSystem.WellKnownFields.GarbageCollectionManager_m_extensionHandlers;
if(fd != null)
{
TypeRepresentation td = fd.OwnerType;
TypeRepresentation tdNew;
if(typeSystem.ForcedDevirtualizations.TryGetValue( td, out tdNew ) == false)
{
throw TypeConsistencyErrorException.Create( "Cannot devirtualize type '{0}'", td );
}
var od = typeSystem.GenerateSingleton( tdNew, DataManager.Attributes.Constant | DataManager.Attributes.SuitableForConstantPropagation );
if(od.Get( fd ) == null)
{
var extensions = typeSystem.GarbageCollectionExtensions;
var handlers = typeSystem.DataManagerInstance.BuildArrayDescriptor( (ArrayReferenceTypeRepresentation)fd.FieldType, DataManager.Attributes.Mutable, null, null, extensions.Count );
int pos = 0;
foreach(var tdSrc in extensions.Keys)
{
handlers.Set( pos++, typeSystem.DataManagerInstance.BuildObjectDescriptor( extensions[tdSrc], DataManager.Attributes.Mutable, null ) );
}
od.Set( fd, handlers );
}
}
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.WellKnownFieldHandler( "Memory_m_availableMemory" )]
private static void Handle_Memory_m_availableMemory( PhaseExecution.NotificationContext nc )
{
Operator op = nc.CurrentOperator;
InstanceFieldRepresentation fd = (InstanceFieldRepresentation)nc.Value;
TypeRepresentation td = fd.OwnerType;
TypeRepresentation tdNew;
if(nc.TypeSystem.ForcedDevirtualizations.TryGetValue( td, out tdNew ) == false)
{
throw TypeConsistencyErrorException.Create( "Cannot devirtualize type '{0}'", td );
}
DataManager.ObjectDescriptor od = nc.TypeSystem.GenerateSingleton( tdNew, DataManager.Attributes.Constant | DataManager.Attributes.SuitableForConstantPropagation );
if(od.Get( fd ) == null)
{
//
// This will be updated later in the compilation process, see Core.CreateAvailableMemoryTables()
//
od.ConvertAndSet( fd, DataManager.Attributes.Constant, null, new Runtime.Memory.Range[0] );
}
//
// This is never null.
//
if(op.HasAnnotation< NotNullAnnotation >() == false)
{
op.AddAnnotation( NotNullAnnotation.Create( nc.TypeSystem ) );
}
}
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations ) )]
[CompilationSteps.PhaseFilter( typeof(Phases.FromImplicitToExplicitExceptions) )]
[CompilationSteps.WellKnownFieldHandler( "ArrayImpl_m_numElements" )]
private static void Handle_ArrayImpl_m_numElements( PhaseExecution.NotificationContext nc )
{
Operator op = nc.CurrentOperator;
if(op is LoadInstanceFieldOperator)
{
if(op.HasAnnotation< ArrayLengthAnnotation >() == false)
{
op.AddAnnotation( ArrayLengthAnnotation.Create( nc.TypeSystem ) );
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Handlers/WellKnownMethodHandlers.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Enable this macro to shift object pointers from the beginning of the header to the beginning of the payload.
#define CANONICAL_OBJECT_POINTERS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Handlers
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class WellKnownMethodHandlers
{
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "Configuration_ExecuteApplication" )]
private static void Handle_Configuration_ExecuteApplication( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
MethodRepresentation md = op.TargetMethod;
MethodRepresentation mdApp = ts.ApplicationEntryPoint;
if(md.MatchSignature( mdApp, null ))
{
op.TargetMethod = mdApp;
nc.MarkAsModified();
return;
}
if(mdApp.ThisPlusArguments.Length == 2)
{
TypeRepresentation tdArg = mdApp.ThisPlusArguments[1];
if(tdArg is ArrayReferenceTypeRepresentation)
{
if(tdArg.ContainedType == ts.WellKnownTypes.System_String)
{
Expression[] rhs = ts.AddTypePointerToArgumentsOfStaticMethod( mdApp, ts.CreateNullPointer( mdApp.ThisPlusArguments[1] ) );
CallOperator callNew = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, mdApp, rhs );
op.SubstituteWithOperator( callNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
return;
}
}
}
throw TypeConsistencyErrorException.Create( "Cannot use '{0}' as an application entry point, incompatible signature", md );
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "RuntimeHelpers_InitializeArray" )]
private static void Handle_RuntimeHelpers_InitializeArray( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
ConstantExpression exConst = op.ThirdArgument as ConstantExpression;
if(exConst != null)
{
DataManager.ObjectDescriptor odHandle = (DataManager.ObjectDescriptor)exConst.Value;
DataManager.ObjectDescriptor odField = (DataManager.ObjectDescriptor)odHandle.Get( (InstanceFieldRepresentation)nc.TypeSystem.WellKnownFields.RuntimeFieldHandleImpl_m_value );
FieldRepresentation fd = (FieldRepresentation)odField.Source;
TypeSystemForCodeTransformation ts = nc.TypeSystem;
//
// Get the field, extract the default value, convert it to an array of the right type, then copy the array.
//
ArrayReferenceTypeRepresentation td = (ArrayReferenceTypeRepresentation)op.SecondArgument.Type;
ScalarTypeRepresentation tdElement = td.ContainedType as ScalarTypeRepresentation;
if(tdElement != null)
{
byte[] rawData = ts.GetDefaultValue( fd );
Type t = tdElement.ConvertToRuntimeType();
Array srcData = Array.CreateInstance( t, rawData.Length / tdElement.Size );
MethodRepresentation md = ts.WellKnownMethods.RuntimeHelpers_InitializeArray2;
Buffer.BlockCopy( rawData, 0, srcData, 0, rawData.Length );
Expression[] rhs = new Expression[] { op.FirstArgument, op.SecondArgument, ts.GenerateConstantArrayAccessor( op, td, srcData, null ) };
CallOperator callNew = StaticCallOperator.New( op.DebugInfo, CallOperator.CallKind.Direct, md, rhs );
op.SubstituteWithOperator( callNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
return;
}
}
throw TypeConsistencyErrorException.Create( "Unsupported array initializer in {0}", op );
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "MarshalImpl_SizeOf__Type" )]
private static void Handle_MarshalImpl_SizeOf__Type( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
while(true)
{
SingleAssignmentOperator opDef;
VTable vTable = InferVirtualTableFromConstantTypeParameter( ts, cfg, op.SecondArgument, out opDef );
if(vTable == null)
{
break;
}
var opNew = SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, ts.CreateConstantForTypeSize( vTable.TypeInfo ) );
if(cfg.FindSingleUse( opDef.FirstResult ) == op)
{
opDef.Delete();
}
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.StopScan();
return;
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "RuntimeHelpers_get_OffsetToStringData" )]
private static void Handle_RuntimeHelpers_get_OffsetToStringData( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
// Return an adjusted offset, accounting for the header size.
ConstantExpression offset = ts.CreateConstantForFieldOffset( ts.WellKnownFields.StringImpl_FirstChar );
#if CANONICAL_OBJECT_POINTERS
var opNew = SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, offset );
#else // CANONICAL_OBJECT_POINTERS
ConstantExpression headerSize = ts.CreateConstantForTypeSize( ts.WellKnownTypes.Microsoft_Zelig_Runtime_ObjectHeader );
var opNew = BinaryOperator.New( op.DebugInfo, BinaryOperator.ALU.ADD, false, false, op.FirstResult, offset, headerSize );
#endif // CANONICAL_OBJECT_POINTERS
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "Object_NullCheck" )]
private static void Handle_Object_NullCheck( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
NullCheckOperator opNew = NullCheckOperator.New( op.DebugInfo, op.SecondArgument );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.CallToWellKnownMethodHandler( "Microsoft_Zelig_Runtime_AbstractMethodWrapper_AddActivationRecordEvent" )]
private static void Handle_Microsoft_Zelig_Runtime_AbstractMethodWrapper_AddActivationRecordEvent( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
if(nc.IsParameterConstant( op, 1 ))
{
int ev = nc.ExtractConstantIntParameter( op, 1 );
var opNew = AddActivationRecordEventOperator.New( op.DebugInfo, (Runtime.ActivationRecordEvents)ev );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CustomAttributeHandler( "Microsoft_Zelig_Runtime_TypeSystem_GenerateUnsafeCastAttribute" )]
private static void Handle_GenerateUnsafeCast( PhaseExecution.NotificationContext nc ,
CustomAttributeRepresentation ca )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
int offset;
if(op.TargetMethod is StaticMethodRepresentation)
{
offset = 1;
}
else
{
offset = 0;
}
if(op.Arguments.Length != offset + 1)
{
throw TypeConsistencyErrorException.Create( "GenerateUnsafeCastAttribute use incompatible with signature for method '{0}'", op.TargetMethod );
}
var opNew = SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, op.Arguments[offset] );
op.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.ApplyConfigurationSettings) )]
[CompilationSteps.CustomAttributeHandler( "Microsoft_Zelig_Runtime_ConfigurationOptionAttribute" )]
private static void Handle_ConfigurationOption( PhaseExecution.NotificationContext nc ,
CustomAttributeRepresentation ca )
{
var cfgProv = nc.TypeSystem.GetEnvironmentService< IConfigurationProvider >();
var op = nc.CurrentOperator;
if(cfgProv != null)
{
string name = (string)ca.FixedArgsValues[0];
object val;
if(cfgProv.GetValue( name, out val ))
{
ConstantExpression ex = nc.TypeSystem.CreateConstantFromObject( val );
if(op is CallOperator)
{
op.SubstituteWithOperator( SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, ex ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
return;
}
if(op is LoadFieldOperator)
{
op.SubstituteWithOperator( SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, ex ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
return;
}
}
}
var call = op as CallOperator;
if(call != null)
{
nc.Phase.CallsDataBase.QueueForForcedInlining( call );
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelToMidLevelConversion) )]
[CompilationSteps.CallToWellKnownMethodHandler( "TypeSystemManager_CastToType" )]
[CompilationSteps.CallToWellKnownMethodHandler( "TypeSystemManager_CastToTypeNoThrow" )]
[CompilationSteps.CallToWellKnownMethodHandler( "TypeSystemManager_CastToSealedType" )]
[CompilationSteps.CallToWellKnownMethodHandler( "TypeSystemManager_CastToSealedTypeNoThrow" )]
private static void Handle_CastToType( PhaseExecution.NotificationContext nc )
{
CallOperator call = nc.GetOperatorAndThrowIfNotCall();
Expression exSrc = call.SecondArgument;
ConstantExpression exVTable = call.ThirdArgument as ConstantExpression;
if(exVTable != null)
{
DataManager.ObjectDescriptor od = (DataManager.ObjectDescriptor)exVTable.Value;
VTable vtable = (VTable )od.Source;
TypeRepresentation tdTarget = vtable.TypeInfo;
TypeRepresentation tdSource = exSrc.Type;
TypeRepresentation tdSource2 = nc.TypeSystem.FindSingleConcreteImplementation( tdSource );
if(tdSource2 != null && tdTarget.CanBeAssignedFrom( tdSource2, null ))
{
var opNew = SingleAssignmentOperator.New( call.DebugInfo, call.FirstResult, exSrc );
call.SubstituteWithOperator( opNew, Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
}
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "TypeImpl_GetTypeFromHandle" )]
private static void Handle_TypeImpl_GetTypeFromHandle( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
ConstantExpression exTd = op.SecondArgument as ConstantExpression;
if(exTd == null)
{
return;
}
DataManager.ObjectDescriptor odRuntimeTypeHandle = exTd.Value as DataManager.ObjectDescriptor;
if(odRuntimeTypeHandle == null)
{
return;
}
DataManager.ObjectDescriptor odVTable = odRuntimeTypeHandle.Get( (InstanceFieldRepresentation)ts.WellKnownFields.RuntimeTypeHandleImpl_m_value ) as DataManager.ObjectDescriptor;
if(odVTable == null)
{
return;
}
op.SubstituteWithOperator( SingleAssignmentOperator.New( op.DebugInfo, op.FirstResult, ts.CreateConstantForType( (VTable)odVTable.Source ) ), Operator.SubstitutionFlags.Default );
nc.MarkAsModified();
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
[CompilationSteps.PhaseFilter( typeof(Phases.HighLevelTransformations) )]
[CompilationSteps.CallToWellKnownMethodHandler( "ActivatorImpl_CreateInstanceInner" )]
private static void Handle_ActivatorImpl_CreateInstanceInner( PhaseExecution.NotificationContext nc )
{
CallOperator op = nc.GetOperatorAndThrowIfNotCall();
TypeSystemForCodeTransformation ts = nc.TypeSystem;
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
//
// We need to substitute the sequence:
//
// opDef : $Temp_1[0](System.Type) = callStatic StaticMethodRepresentation(System.Type System.Type::GetTypeFromHandle(System.RuntimeTypeHandle))( , $Const(System.RuntimeTypeHandle $Object(System.RuntimeTypeHandle)) )
// op : $Temp_2[1](object) = callStatic StaticMethodRepresentation(object System.Activator::CreateInstanceInner(System.Type))( , $Temp_1[0](System.Type) )
// opUse : (T) = $Temp_2[1](object) cast as T
//
// with the sequence:
//
// (T) = new T;
// call (T)T()
//
while(true)
{
SingleAssignmentOperator opDef;
VTable vTable = InferVirtualTableFromConstantTypeParameter( ts, cfg, op.SecondArgument, out opDef );
if(vTable == null)
{
break;
}
TypeRepresentation tdTarget = vTable.TypeInfo;
CastOperator opUse = cfg.FindSingleUse( op.FirstResult ) as CastOperator;
if(opUse == null)
{
break;
}
VariableExpression varTarget = opUse.FirstResult;
if(varTarget.Type.CanBeAssignedFrom( tdTarget, null ) == false)
{
break;
}
ConstructorMethodRepresentation mdTarget = tdTarget.FindDefaultConstructor();
if(mdTarget == null)
{
break;
}
op.AddOperatorBefore( ObjectAllocationOperator.New( op.DebugInfo, tdTarget, varTarget ) );
op.AddOperatorBefore( InstanceCallOperator .New( op.DebugInfo, CallOperator.CallKind.Direct, mdTarget, new Expression[] { varTarget }, false) );
if(cfg.FindSingleUse( opDef.FirstResult ) == op)
{
opDef.Delete();
}
op .Delete();
opUse.Delete();
nc.StopScan();
return;
}
throw TypeConsistencyErrorException.Create( "INTERNAL ERROR: Unrecognized use of {0}", op.TargetMethod );
}
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
public static VTable InferVirtualTableFromConstantTypeParameter( TypeSystemForCodeTransformation ts ,
ControlFlowGraphStateForCodeTransformation cfg ,
Expression ex ,
out SingleAssignmentOperator opDef )
{
opDef = cfg.FindSingleDefinition( ex ) as SingleAssignmentOperator;
if(opDef == null)
{
return null;
}
var exType = opDef.FirstArgument as ConstantExpression;
if(exType == null)
{
return null;
}
var dt = exType.Value as TypeSystemForCodeTransformation.DelayedType;
if(dt != null)
{
return dt.VTable;
}
return null;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ApplyClassExtensions.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
internal sealed class ApplyClassExtensions : Transformations.ScanTypeSystem
{
//
// State
//
private Transformations.ReverseIndexTypeSystem m_reverseIndex;
private List< Transformations.PerformClassExtension.Duplicate > m_duplicates;
private bool m_fChanged;
//
// Constructor Methods
//
internal ApplyClassExtensions( TypeSystemForCodeTransformation typeSystem ) : base( typeSystem, typeof(ApplyClassExtensions) )
{
m_fChanged = false;
}
//
// Helper Methods
//
internal static bool Hack_MirrorGenericInstantiations( TypeSystemForCodeTransformation typeSystem )
{
bool fChanged = false;
typeSystem.BuildGenericInstantiationTables();
foreach(TypeRepresentation td in typeSystem.Types.ToArray())
{
CustomAttributeRepresentation ca = td.FindCustomAttribute( typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_ExtendClassAttribute );
if(ca != null)
{
object objTarget = ca.FixedArgsValues[0];
TypeRepresentation tdTarget = objTarget as TypeRepresentation;
object obj = ca.GetNamedArg( "PlatformVersionFilter" );
if(obj != null)
{
uint filter = (uint)obj;
if(( filter & typeSystem.PlatformAbstraction.PlatformVersion ) != typeSystem.PlatformAbstraction.PlatformVersion)
{
// This type is not an allowed extension for the current platform
continue;
}
}
if(tdTarget == null)
{
tdTarget = typeSystem.GetWellKnownTypeNoThrow( objTarget as string );
}
if(tdTarget == null)
{
throw TypeConsistencyErrorException.Create( "Missing target class to extend: {0}", objTarget );
}
if(td.IsOpenType == false && tdTarget.IsOpenType)
{
tdTarget = typeSystem.CreateInstantiationOfGenericTemplate( tdTarget, td.GenericParameters );
}
if(tdTarget.IsOpenType)
{
List< TypeRepresentation > lstTdTarget;
if(typeSystem.GenericTypeInstantiations.TryGetValue( tdTarget, out lstTdTarget ))
{
List< TypeRepresentation > lstTd;
typeSystem.GenericTypeInstantiations.TryGetValue( td, out lstTd );
foreach(var td2 in lstTdTarget)
{
var tdNew = typeSystem.CreateInstantiationOfGenericTemplate( td, td2.GenericParameters );
if(td != tdNew && (lstTd == null || lstTd.Contains( tdNew ) == false))
{
fChanged = true;
}
}
}
}
else
{
fChanged |= Hack_ProcessType( typeSystem, td, tdTarget );
}
}
}
return fChanged;
}
private static bool Hack_ProcessType( TypeSystemForCodeTransformation typeSystem ,
TypeRepresentation td ,
TypeRepresentation tdTarget )
{
bool fChanged = false;
var ht = IR.Transformations.PerformClassExtension.Hack_GetSubstitutionTable( typeSystem, td, tdTarget );
foreach(var mdOverriding in ht.Keys)
{
if(mdOverriding.IsOpenMethod)
{
var mdOverridden = ht[mdOverriding];
List< MethodRepresentation > lstMdOverridden;
if(typeSystem.GenericMethodInstantiations.TryGetValue( mdOverridden, out lstMdOverridden ))
{
List< MethodRepresentation > lstMdOverriding;
typeSystem.GenericMethodInstantiations.TryGetValue( mdOverriding, out lstMdOverriding );
foreach(var md in lstMdOverridden)
{
if(md.IsOpenMethod == false)
{
var mdNew = typeSystem.CreateInstantiationOfGenericTemplate( mdOverriding, md.GenericParameters );
if(lstMdOverriding == null || lstMdOverriding.Contains( mdNew ) == false)
{
fChanged = true;
}
}
}
}
}
}
return fChanged;
}
//--//
internal void Run()
{
m_reverseIndex = new Transformations.ReverseIndexTypeSystem( m_typeSystem );
m_duplicates = new List< Transformations.PerformClassExtension.Duplicate >();
//
// We need to deal with Generic Types and Methods.
//
// For generic types, we need to ensure we have as many specialization of the overridding type as those of the overridden one.
//
// For generic methods, we need to ensure that the overriding generic method is instantiated as many times as the overridden one.
//
//
// To speed up the processing of mapping from the overridding entities to the overridden ones,
// we build a reverse index of the whole type system.
//
using(new Transformations.ExecutionTiming( "ReverseIndexTypeSystem" ))
{
m_reverseIndex.ProcessTypeSystem();
}
//
// Process types that are generic parameters types first
//
var genericParametersTypes = new List();
foreach(TypeRepresentation td in m_typeSystem.Types)
{
foreach(var parameter in td.GenericParameters)
{
if(parameter is DelayedMethodParameterTypeRepresentation || parameter is DelayedTypeParameterTypeRepresentation)
{
continue;
}
genericParametersTypes.Add( parameter );
}
}
foreach(TypeRepresentation td in genericParametersTypes)
{
ProcessType( td );
}
//
// Process all other types
//
foreach(TypeRepresentation td in m_typeSystem.Types.ToArray())
{
ProcessType( td );
}
if(m_fChanged)
{
if(m_duplicates.Count > 0)
{
Transformations.PerformClassExtension pfe = new Transformations.PerformClassExtension( m_typeSystem, m_reverseIndex, m_duplicates );
pfe.ProcessDuplicates();
}
//
// We need to rebuild all the hash tables.
//
TypeSystemForCodeTransformation typeSystem = m_typeSystem;
Transform( ref typeSystem );
typeSystem.RefreshHashCodesAfterTypeSystemRemapping();
}
}
//--//
protected override bool ShouldRefreshHashCodes()
{
return true;
}
//--//
private void ProcessType( TypeRepresentation td )
{
if(m_typeSystem.ReachabilitySet.IsProhibited( td ) == false)
{
CustomAttributeRepresentation ca = td.FindCustomAttribute( m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_ExtendClassAttribute );
if(ca != null)
{
object objTarget = ca.FixedArgsValues[0];
TypeRepresentation tdTarget = objTarget as TypeRepresentation;
bool fNoConstructors = false;
object obj;
obj = ca.GetNamedArg( "PlatformVersionFilter" );
if(obj != null)
{
uint filter = (uint)obj;
if((filter & m_typeSystem.PlatformAbstraction.PlatformVersion) != m_typeSystem.PlatformAbstraction.PlatformVersion)
{
// This type is not an allowed extension for the current platform
return;
}
}
if(tdTarget == null)
{
tdTarget = m_typeSystem.GetWellKnownTypeNoThrow( objTarget as string );
}
if(tdTarget == null)
{
throw TypeConsistencyErrorException.Create( "Missing target class to extend: {0}", objTarget );
}
if(td.IsOpenType == false && tdTarget.IsOpenType)
{
List< TypeRepresentation > lstTdTarget;
if(m_typeSystem.GenericTypeInstantiations.TryGetValue( tdTarget, out lstTdTarget ) == false)
{
throw TypeConsistencyErrorException.Create( "Found mismatch between instantiation of class extension and target class: {0} not compatible with {1}", td, tdTarget );
}
tdTarget = null;
foreach(var tdTarget2 in lstTdTarget)
{
if(tdTarget2.IsOpenType == false && ArrayUtility.ArrayEqualsNotNull( td.GenericParameters, tdTarget2.GenericParameters, 0 ))
{
tdTarget = tdTarget2;
}
}
if(tdTarget == null)
{
throw TypeConsistencyErrorException.Create( "Missing target class to extend: {0}", objTarget );
}
}
obj = ca.GetNamedArg( "NoConstructors" );
if(obj != null)
{
fNoConstructors = (bool)obj;
}
obj = ca.GetNamedArg( "ProcessAfter" );
if(obj != null)
{
TypeRepresentation tdPre = (TypeRepresentation)obj;
if(tdPre.HasCustomAttribute( m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_ExtendClassAttribute ))
{
ProcessType( tdPre );
}
}
TypeRepresentation tdExtends = td.Extends;
if(tdExtends != null)
{
ProcessType( tdExtends );
}
//
// HACK: Generic type extension is handled at the end of meta data import.
//
if(td.IsOpenType || tdTarget.IsOpenType)
{
return;
}
using(new Transformations.ExecutionTiming( "PerformClassExtension from {0} to {1}", td, tdTarget ))
{
var pfe = new Transformations.PerformClassExtension( m_typeSystem, m_reverseIndex, m_duplicates, td, tdTarget, fNoConstructors );
pfe.Execute();
}
m_fChanged = true;
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/CallGraph.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class CallGraph
{
public delegate bool ShouldIncludeInClosureDelegate( MethodRepresentation md );
//
// State
//
private TypeSystemForCodeTransformation m_typeSystem;
private GrowOnlyHashTable< MethodRepresentation, List< MethodRepresentation > > m_methods;
private GrowOnlyHashTable< MethodRepresentation, List< MethodRepresentation > > m_methodsThatRequireStaticConstructors;
private GrowOnlySet < MethodRepresentation > m_methodsUsedInDelegates;
//
// Constructor Methods
//
public CallGraph( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
m_methods = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, List< MethodRepresentation > >();
m_methodsThatRequireStaticConstructors = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, List< MethodRepresentation > >();
m_methodsUsedInDelegates = SetFactory .NewWithReferenceEquality< MethodRepresentation >();
//--//
typeSystem.EnumerateFlowGraphs( delegate ( ControlFlowGraphStateForCodeTransformation cfg )
{
var tdCodePointer = m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_TypeSystem_CodePointer;
foreach(Operator op in cfg.DataFlow_SpanningTree_Operators)
{
MethodRepresentationOperator opMd = op as MethodRepresentationOperator;
if(opMd != null)
{
m_methodsUsedInDelegates.Insert( opMd.Method );
}
FieldOperator opFd = op as FieldOperator;
if(opFd != null)
{
FieldRepresentation fd = opFd.Field;
InstanceFieldRepresentation fdI = fd as InstanceFieldRepresentation;
if(fdI != null)
{
fd = fdI.ImplementationOf;
}
if(fd is StaticFieldRepresentation)
{
MethodRepresentation mdCCtor = fd.OwnerType.FindDefaultStaticConstructor();
if(mdCCtor != null)
{
MethodRepresentation mdFrom = cfg.Method;
if(mdFrom != mdCCtor)
{
HashTableWithListFactory.AddUnique( m_methodsThatRequireStaticConstructors, mdFrom, mdCCtor );
}
}
}
}
foreach(var ex in op.Arguments)
{
var exConst = ex as ConstantExpression;
if(exConst != null && exConst.Type == tdCodePointer)
{
var od = (DataManager.ObjectDescriptor)exConst.Value;
if(od != null)
{
var cp = (CodePointer)od.Source;
var md = m_typeSystem.DataManagerInstance.GetCodePointerFromUniqueID( cp.Target ) as MethodRepresentation;
if(md != null)
{
m_methodsUsedInDelegates.Insert( md );
}
}
}
}
}
} );
typeSystem.EnumerateMethods( delegate ( MethodRepresentation md )
{
Analyze( md );
} );
}
//
// Helper Methods
//
public GrowOnlySet< MethodRepresentation > ComputeClosure( MethodRepresentation md ,
ShouldIncludeInClosureDelegate dlg )
{
GrowOnlySet< MethodRepresentation > set = SetFactory.NewWithReferenceEquality< MethodRepresentation >();
set.Insert( md );
ExpandClosure( set, md, dlg );
return set;
}
private void ExpandClosure( GrowOnlySet< MethodRepresentation > set ,
MethodRepresentation md ,
ShouldIncludeInClosureDelegate dlg )
{
ExpandClosure( set, md, dlg, m_methods );
ExpandClosure( set, md, dlg, m_methodsThatRequireStaticConstructors );
}
private void ExpandClosure( GrowOnlySet< MethodRepresentation > set ,
MethodRepresentation md ,
ShouldIncludeInClosureDelegate dlg ,
GrowOnlyHashTable< MethodRepresentation, List< MethodRepresentation > > ht )
{
List< MethodRepresentation > lst;
if(ht.TryGetValue( md, out lst ))
{
foreach(MethodRepresentation mdNext in lst)
{
if(set.Insert( mdNext ) == false)
{
if(dlg != null && dlg( mdNext ) == false)
{
continue;
}
ExpandClosure( set, mdNext, dlg );
}
}
}
}
//--//
private void Analyze( MethodRepresentation mdFrom )
{
List< MethodRepresentation > lst;
if(HashTableWithListFactory.Create( m_methods, mdFrom, out lst ))
{
//
// Already analyzed.
//
return;
}
ControlFlowGraphStateForCodeTransformation cfgFrom = TypeSystemForCodeTransformation.GetCodeForMethod( mdFrom );
if(cfgFrom != null)
{
foreach(var call in cfgFrom.FilterOperators< CallOperator >())
{
MethodRepresentation mdTo = call.TargetMethod;
switch(call.CallType)
{
case CallOperator.CallKind.Direct:
case CallOperator.CallKind.Overridden:
case CallOperator.CallKind.OverriddenNoCheck:
AddEdge( mdFrom, mdTo );
break;
case CallOperator.CallKind.Virtual:
case CallOperator.CallKind.Indirect:
AddVirtualEdge( mdFrom, (VirtualMethodRepresentation)mdTo );
break;
default:
throw TypeConsistencyErrorException.Create( "Unsupported call '{0}' found in '{1}'", call, cfgFrom );
}
TypeRepresentation td = mdTo.OwnerType;
if(td.IsAbstract == false && td.IsSubClassOf( m_typeSystem.WellKnownTypes.System_Delegate, null ))
{
switch(mdTo.Name)
{
case "Invoke":
foreach(MethodRepresentation mdDlg in m_methodsUsedInDelegates)
{
if(mdDlg.MatchSignature( mdTo, null ))
{
AddEdge( mdFrom, mdDlg );
}
}
break;
}
}
}
}
}
private void AddVirtualEdge( MethodRepresentation mdFrom ,
VirtualMethodRepresentation mdTo )
{
//
// Include all the overrides for this method in all the subclasses already reached by the closure computation.
//
int index = mdTo.FindVirtualTableIndex();
TypeRepresentation td = mdTo.OwnerType;
AddOverrides( mdFrom, td, index );
//--//
//
// The method belongs to an interface, we have to include all the implementations in all the touched types.
//
if(td is InterfaceTypeRepresentation)
{
InterfaceTypeRepresentation itf = (InterfaceTypeRepresentation)td;
int itfIndex = mdTo.FindInterfaceTableIndex();
foreach(TypeRepresentation td2 in m_typeSystem.InterfaceImplementors[itf])
{
MethodRepresentation mdOverride = td2.FindInterfaceTable( itf )[itfIndex];
AddEdge( mdFrom, mdOverride );
}
}
}
private void AddOverrides( MethodRepresentation mdFrom ,
TypeRepresentation td ,
int index )
{
List< TypeRepresentation > lst;
if(m_typeSystem.DirectDescendant.TryGetValue( td, out lst ))
{
foreach(TypeRepresentation td2 in lst)
{
AddEdge( mdFrom, td2.MethodTable[index] );
AddOverrides( mdFrom, td2, index );
}
}
}
private void AddEdge( MethodRepresentation from ,
MethodRepresentation to )
{
HashTableWithListFactory.AddUnique( m_methods, from, to );
Analyze( to );
}
//
// Access Methods
//
public GrowOnlyHashTable< MethodRepresentation, List< MethodRepresentation > > Methods
{
get
{
return m_methods;
}
}
public GrowOnlyHashTable< MethodRepresentation, List< MethodRepresentation > > MethodsThatRequireStaticConstructors
{
get
{
return m_methodsThatRequireStaticConstructors;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/CallsDatabase.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.Zelig.Runtime.TypeSystem;
public interface IInlineOptions
{
bool HonorInlineAttribute { get; }
bool EnableAutoInlining { get; }
bool InjectPrologAndEpilog { get; }
}
public sealed class CallsDataBase
{
internal class Entry
{
//
// State
//
int m_version;
ControlFlowGraphStateForCodeTransformation m_cfg;
ControlFlowGraphStateForCodeTransformation m_clonedCFG;
List< CallOperator > m_callsFromThisMethod;
List< CallOperator > m_callsToThisMethod;
IInlineOptions m_InlineOptions;
//
// Constructor Methods
//
internal Entry( ControlFlowGraphStateForCodeTransformation cfg )
{
m_cfg = cfg;
m_version = -1;
m_callsFromThisMethod = new List< CallOperator >();
m_callsToThisMethod = new List< CallOperator >();
m_InlineOptions = cfg.TypeSystem.GetEnvironmentService( );
}
//
// Helper Methods
//
internal void Reset()
{
m_callsFromThisMethod.Clear();
m_callsToThisMethod .Clear();
}
internal void AddCallFromThisMethod( CallOperator call )
{
lock(this)
{
m_callsFromThisMethod.Add( call );
}
}
internal void AddCallToThisMethod( CallOperator call )
{
lock(this)
{
m_callsToThisMethod.Add( call );
}
}
internal void AnalyzeInlining()
{
if(m_version != m_cfg.Version)
{
m_version = m_cfg.Version;
bool fInline = false;
MethodRepresentation md = m_cfg.Method;
if(md.HasBuildTimeFlag( MethodRepresentation.BuildTimeAttributes.NoInline ))
{
fInline = false;
}
else if(md.HasBuildTimeFlag( MethodRepresentation.BuildTimeAttributes.Inline ))
{
if( m_InlineOptions == null || m_InlineOptions.HonorInlineAttribute )
fInline = true;
}
else if( m_InlineOptions == null || m_InlineOptions.EnableAutoInlining )
{
bool fCallToConstructor = false;
int iCall = 0;
int iGetter = 0;
int iSetter = 0;
int iOther = 0;
var set = SetFactory.NewWithReferenceEquality< BasicBlock >();
var queue = new Queue < BasicBlock >();
var bbStart = m_cfg.NormalizedEntryBasicBlock;
var bbEnd = m_cfg.NormalizedExitBasicBlock;
set .Insert ( bbStart );
queue.Enqueue( bbStart );
while(queue.Count > 0)
{
var bb = queue.Dequeue();
foreach(var edge in bb.Successors)
{
var bbNext = edge.Successor;
if(bbNext != bbEnd && set.Insert( bbNext ) == false)
{
queue.Enqueue( bbNext );
}
}
foreach(Operator op in bb.Operators)
{
if(op is CallOperator)
{
CallOperator call = (CallOperator)op;
if(call.TargetMethod is ConstructorMethodRepresentation)
{
fCallToConstructor = true;
}
else
{
iCall++;
}
}
else if(op is LoadFieldOperator)
{
iGetter++;
}
else if(op is StoreFieldOperator)
{
iSetter++;
}
else if(op is NopOperator ||
op is UnconditionalControlOperator ||
op is AbstractAssignmentOperator ||
op is ReturnControlOperator )
{
// Ignore them.
}
else
{
iOther++;
}
}
}
if(!fCallToConstructor && iGetter == 0 && iSetter == 0 && iOther == 0)
{
fInline = true; // Noop method.
}
else if(fCallToConstructor && iGetter == 0 && iSetter == 0 && iOther == 0)
{
fInline = true; // Empty constructor.
}
else if(!fCallToConstructor && iGetter == 1 && iSetter == 0 && iOther < 2)
{
fInline = true; // Simple getter.
}
else if(!fCallToConstructor && iGetter == 0 && iSetter == 1 && iOther == 0)
{
fInline = true; // Simple setter.
}
else if(!fCallToConstructor && iGetter == 0 && iSetter == 0 && iCall == 0 && iOther < 4)
{
fInline = true; // Simple method with no calls.
}
else
{
fInline = false;
}
}
if( fInline)
{
m_clonedCFG = m_cfg.Clone( null );
}
else
{
m_clonedCFG = null;
}
}
}
internal void EnsureCloned()
{
if(m_clonedCFG == null)
{
m_clonedCFG = m_cfg.Clone( null );
}
}
internal void QueueInlining( GrowOnlySet< ControlFlowGraphStateForCodeTransformation > touched ,
GrowOnlyHashTable< ControlFlowGraphStateForCodeTransformation, List< CallOperator > > workList )
{
if(m_clonedCFG != null)
{
for(int pos = m_callsToThisMethod.Count; --pos >= 0; )
{
bool fRemove = false;
CallOperator call = m_callsToThisMethod[pos];
while(true)
{
BasicBlock bb = call.BasicBlock;
if(bb == null)
{
//
// Dead operator, just remove it.
//
fRemove = true;
break;
}
var cfg = (ControlFlowGraphStateForCodeTransformation)bb.Owner;
if(cfg == m_cfg)
{
//
// Can't self-inline.
//
break;
}
//
// Detect inlining loops and stop them.
//
var an = call.GetAnnotation< InliningPathAnnotation >();
if(an != null)
{
if(ArrayUtility.FindInNotNullArray( an.Path, m_clonedCFG.Method ) >= 0)
{
break;
}
}
var callType = call.CallType;
if(callType == CallOperator.CallKind.Virtual ||
callType == CallOperator.CallKind.Indirect )
{
break;
}
var cfgInlineSite = (ControlFlowGraphStateForCodeTransformation)call.BasicBlock.Owner;
touched.Insert( cfgInlineSite );
HashTableWithListFactory.AddUnique( workList, cfgInlineSite, call );
fRemove = true;
break;
}
if(fRemove)
{
m_callsToThisMethod.RemoveAt( pos );
}
}
}
}
//
// Access Methods
//
internal ControlFlowGraphStateForCodeTransformation Cfg
{
get
{
return m_cfg;
}
}
internal ControlFlowGraphStateForCodeTransformation ClonedCfg
{
get
{
return m_clonedCFG;
}
}
internal List< CallOperator > CallFromThisMethod
{
get
{
return m_callsFromThisMethod;
}
}
internal List< CallOperator > CallToThisMethod
{
get
{
return m_callsToThisMethod;
}
}
}
//
// State
//
private GrowOnlyHashTable< ControlFlowGraphStateForCodeTransformation, Entry > m_entries;
private GrowOnlySet < CallOperator > m_forcedInlines;
//
// Constructor Methods
//
public CallsDataBase()
{
m_entries = HashTableFactory.NewWithReferenceEquality< ControlFlowGraphStateForCodeTransformation, Entry >();
m_forcedInlines = SetFactory .NewWithReferenceEquality< CallOperator >();
}
//
// Helper Methods
//
public void RegisterCallSite( CallOperator call )
{
var cfgFrom = (ControlFlowGraphStateForCodeTransformation) call.BasicBlock.Owner;
var cfgTo = TypeSystemForCodeTransformation.GetCodeForMethod( call.TargetMethod );
Entry enFrom = GetEntry( cfgFrom, true );
enFrom.AddCallFromThisMethod( call );
if(cfgTo != null)
{
Entry enTo = GetEntry( cfgTo, true );
enTo.AddCallToThisMethod( call );
}
}
public void QueueForForcedInlining( CallOperator call )
{
lock(TypeSystemForCodeTransformation.Lock) // It's called from multiple threads during parallel phase executions.
{
m_forcedInlines.Insert( call );
}
}
public void ClearCallSites()
{
m_entries.Clear();
}
public void ResetCallSites()
{
foreach(Entry en in m_entries.Values)
{
en.Reset();
}
}
public List< CallOperator > CallsToMethod( MethodRepresentation md )
{
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
Entry en = GetEntry( cfg, false );
return (en != null) ? en.CallToThisMethod : null;
}
public List< CallOperator > CallsFromMethod( MethodRepresentation md )
{
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
Entry en = GetEntry( cfg, false );
return (en != null) ? en.CallFromThisMethod : null;
}
//--//
public CallsDataBase Analyze( TypeSystemForCodeTransformation typeSystem )
{
ResetCallSites();
ParallelTransformationsHandler.EnumerateFlowGraphs( typeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
foreach(var call in cfg.FilterOperators< CallOperator >())
{
RegisterCallSite( call );
}
} );
return this;
}
public void AnalyzeForInlining()
{
foreach(Entry en in m_entries.Values)
{
en.AnalyzeInlining();
}
}
public GrowOnlySet< ControlFlowGraphStateForCodeTransformation > ExecuteInlining( TypeSystemForCodeTransformation typeSystem )
{
var workList = HashTableFactory.NewWithReferenceEquality< ControlFlowGraphStateForCodeTransformation, List< CallOperator > >();
var touched = SetFactory .NewWithReferenceEquality< ControlFlowGraphStateForCodeTransformation >();
var touched2 = touched.CloneSettings();
while(true)
{
workList.Clear();
touched2.Clear();
foreach(Entry en in m_entries.Values)
{
en.QueueInlining( touched2, workList );
}
foreach(CallOperator call in m_forcedInlines)
{
if(!call.IsDetached)
{
var cfgInlineSite = (ControlFlowGraphStateForCodeTransformation)call.BasicBlock.Owner;
var cfgTarget = TypeSystemForCodeTransformation.GetCodeForMethod( call.TargetMethod );
touched2.Insert( cfgInlineSite );
var en = GetEntry( cfgTarget, true );
en.EnsureCloned();
HashTableWithListFactory.AddUnique( workList, cfgInlineSite, call );
}
}
if(workList.Count == 0)
{
break;
}
//--//
var lockList = HashTableFactory.NewWithReferenceEquality< ControlFlowGraphStateForCodeTransformation, IDisposable >();
foreach(var cfg in workList.Keys)
{
foreach(var call in workList[cfg])
{
var cfgTarget = TypeSystemForCodeTransformation.GetCodeForMethod( call.TargetMethod );
Entry en;
m_entries.TryGetValue( cfgTarget, out en );
var cfgCloned = en.ClonedCfg;
if(lockList.ContainsKey( cfgCloned ) == false)
{
var bbEntry = cfgCloned.NormalizedEntryBasicBlock;
var bbExit = cfgCloned.NormalizedExitBasicBlock;
lockList[cfgTarget] = cfgCloned.LockFlowInformation();
}
}
}
ParallelTransformationsHandler.EnumerateFlowGraphs( typeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
List< CallOperator > calls;
bool fGot = false;
if(workList.TryGetValue( cfg, out calls ))
{
foreach(var call in calls)
{
var cfgTarget = TypeSystemForCodeTransformation.GetCodeForMethod( call.TargetMethod );
Entry en;
m_entries.TryGetValue( cfgTarget, out en );
cfg.TraceToFile( "InlineCall" );
using(ControlFlowGraphState.AddExceptionToThreadMethodLock( call.TargetMethod ))
{
Transformations.InlineCall.Execute( call, en.ClonedCfg, null );
}
cfg.TraceToFile( "InlineCall-Post" );
fGot = true;
}
if(fGot)
{
Transformations.CommonMethodRedundancyElimination.Execute( cfg );
cfg.DropDeadVariables();
}
}
} );
foreach(var disp in lockList.Values)
{
disp.Dispose();
}
touched.Merge( touched2 );
}
return touched;
}
//--//
Entry GetEntry( ControlFlowGraphStateForCodeTransformation cfg ,
bool fAllocate )
{
lock(TypeSystemForCodeTransformation.Lock) // It's called from multiple threads during parallel phase executions.
{
Entry entry;
if(m_entries.TryGetValue( cfg, out entry ) == false && fAllocate)
{
entry = new Entry( cfg );
m_entries[cfg] = entry;
}
return entry;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ComputeCallsClosure.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define COMPUTECALLSCLOSURE_FORCE_SINGLE_THREADED
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public interface ICallClosureComputationTarget
{
void ExpandClosure( ComputeCallsClosure.Context host );
}
public sealed class ComputeCallsClosure
{
public delegate void Notification( Context host, Operator op );
public class Context
{
//
// State
//
private readonly ComputeCallsClosure m_owner;
private readonly TypeSystem.Reachability m_reachabilitySet;
//
// Constructor Methods
//
internal Context( ComputeCallsClosure owner ,
TypeSystem.Reachability reachabilitySet )
{
m_owner = owner;
m_reachabilitySet = reachabilitySet;
}
//
// Helper Methods
//
internal void ProcessMethod( MethodRepresentation md )
{
CoverObject( md );
ControlFlowGraphStateForCodeTransformation cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
Transformations.ScanCodeWithCallback.Execute( m_owner.m_typeSystem, this, cfg, delegate( Operator op, object target )
{
if(target != null)
{
MethodRepresentation mdTarget = target as MethodRepresentation;
if(mdTarget != null)
{
m_owner.QueueMethodForProcessing( mdTarget );
}
CoverObject( target );
if(target is Operator)
{
Operator opTarget = (Operator)target;
Type type = opTarget.GetType();
while(type != null)
{
List< Notification > lst;
if(m_owner.m_delegation.TryGetValue( type, out lst ))
{
foreach(Notification dlg in lst)
{
dlg( this, opTarget );
}
}
type = type.BaseType;
}
CallOperator call = opTarget as CallOperator;
if(call != null)
{
m_owner.m_callsDatabase.RegisterCallSite( call );
}
var tdCodePointer = m_owner.m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_TypeSystem_CodePointer;
foreach(var ex in opTarget.Arguments)
{
var exConst = ex as ConstantExpression;
if(exConst != null && exConst.Type == tdCodePointer)
{
var od = (DataManager.ObjectDescriptor)exConst.Value;
if(od != null)
{
var cp = (CodePointer)od.Source;
var mdDelegate = m_owner.m_typeSystem.DataManagerInstance.GetCodePointerFromUniqueID( cp.Target );
CoverObject( mdDelegate );
}
}
}
}
}
return Transformations.ScanCodeWithCallback.CallbackResult.Proceed;
} );
}
}
public void CoverObject( object obj )
{
if(obj == null) return;
if(obj is MethodRepresentation)
{
CoverMethod( (MethodRepresentation)obj );
}
else if(obj is FieldRepresentation)
{
CoverField( (FieldRepresentation)obj );
}
else if(obj is TypeRepresentation)
{
CoverType( (TypeRepresentation)obj );
}
else if(obj is AssemblyRepresentation)
{
CoverAssembly( (AssemblyRepresentation)obj );
}
else if(obj is CustomAttributeRepresentation)
{
CoverCustomAttribute( (CustomAttributeRepresentation)obj );
}
else if(obj is CustomAttributeAssociationRepresentation)
{
CoverCustomAttributeAssociation( (CustomAttributeAssociationRepresentation)obj );
}
else if(obj is ICallClosureComputationTarget)
{
ICallClosureComputationTarget itf = (ICallClosureComputationTarget)obj;
itf.ExpandClosure( this );
}
else
{
m_reachabilitySet.ExpandPending( obj );
}
}
private void CoverReflectionType( object obj )
{
TypeRepresentation td = m_owner.m_typeSystem.TryGetTypeRepresentationFromType( obj.GetType() );
if(td != null)
{
CoverType( td );
}
}
private void CoverAssembly( AssemblyRepresentation asml )
{
m_reachabilitySet.ExpandPending( asml );
}
private void CoverType( TypeRepresentation td )
{
while(td != null)
{
if(m_reachabilitySet.ExpandPending( td ))
{
break;
}
CoverReflectionType( td );
CoverAssembly( td.Owner );
CoverType( td.Extends );
CoverType( td.EnclosingClass );
//
// If a generic type, include the context.
//
TypeRepresentation.GenericContext gc = td.Generic;
if(gc != null)
{
CoverType( gc.Template );
foreach(TypeRepresentation td2 in gc.Parameters)
{
CoverType( td2 );
}
GenericParameterDefinition[] parametersDefinition = gc.ParametersDefinition;
if(parametersDefinition != null)
{
for(int i = 0; i < parametersDefinition.Length; i++)
{
foreach(TypeRepresentation constraint in parametersDefinition[i].Constraints)
{
CoverType( constraint );
}
}
}
}
//
// These are weird objects, because they actually contain a use of themselves in their definition.
// We want to keep the fields alive, so that the size computation doesn't generate the wrong values.
//
if(td is ScalarTypeRepresentation)
{
foreach(FieldRepresentation fd in td.Fields)
{
if(fd is InstanceFieldRepresentation)
{
CoverField( fd );
}
}
}
if(td is ArrayReferenceTypeRepresentation)
{
//
// Keep alive also the managed pointer to the elements of the array, it will be used later.
//
CoverType( m_owner.m_typeSystem.GetManagedPointerToType( td.ContainedType ) );
}
//
// For a non-pointer type, keep alive any associated pointer type.
//
if(!(td is PointerTypeRepresentation))
{
foreach(TypeRepresentation td2 in m_owner.m_typeSystem.Types)
{
PointerTypeRepresentation ptr = td2 as PointerTypeRepresentation;
if(ptr != null && ptr.ContainedType == td)
{
CoverType( ptr );
}
}
}
//
// Look for all the fields, if they have an "AssumeReferenced" attribute, force them to be included.
//
{
TypeRepresentation tdAttrib = m_owner.m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_TypeSystem_AssumeReferencedAttribute;
foreach(FieldRepresentation fd in td.Fields)
{
if(fd.HasCustomAttribute( tdAttrib ))
{
CoverField( fd );
}
}
}
//
// Look for all the methods that are marked as exception handlers and include them.
//
{
var heh = m_owner.m_typeSystem.HardwareExceptionHandlers;
foreach(MethodRepresentation md in td.Methods)
{
CustomAttributeRepresentation ca;
if(heh.TryGetValue( md, out ca ))
{
CoverMethod ( md );
CoverCustomAttribute( ca );
}
}
}
//
// Look for all the methods that are marked as debugger handlers and include them.
//
{
var dhh = m_owner.m_typeSystem.DebuggerHookHandlers;
foreach(MethodRepresentation md in td.Methods)
{
CustomAttributeRepresentation ca;
if(dhh.TryGetValue( md, out ca ))
{
CoverMethod ( md );
CoverCustomAttribute( ca );
}
}
}
td = td.ContainedType;
}
}
private void CoverField( FieldRepresentation fd )
{
if(fd == null) return;
if(m_reachabilitySet.ExpandPending( fd ))
{
return;
}
CoverReflectionType( fd );
CoverType( fd.OwnerType );
CoverType( fd.FieldType );
if(fd is StaticFieldRepresentation)
{
StaticFieldRepresentation fdS = (StaticFieldRepresentation)fd;
CoverField( fdS.ImplementedBy );
CoverStaticConstructor( fdS );
}
if(fd is InstanceFieldRepresentation)
{
InstanceFieldRepresentation fdI = (InstanceFieldRepresentation)fd;
CoverField( fdI.ImplementationOf );
CoverStaticConstructor( fdI.ImplementationOf );
}
}
private void CoverStaticConstructor( StaticFieldRepresentation fd )
{
if(fd == null) return;
StaticConstructorMethodRepresentation md = fd.OwnerType.FindDefaultStaticConstructor();
if(md != null)
{
CoverMethod( md );
CoverMethod( m_owner.m_typeSystem.WellKnownMethods.TypeSystemManager_InvokeStaticConstructors );
}
}
private void CoverMethod( MethodRepresentation md )
{
if(md == null) return;
if(m_reachabilitySet.ExpandPending( md ))
{
return;
}
CoverReflectionType( md );
m_owner.QueueMethodForProcessing( md );
//
// If a generic method, include the context.
//
MethodRepresentation.GenericContext gc = md.Generic;
if(gc != null)
{
CoverMethod( gc.Template );
foreach(TypeRepresentation td in gc.Parameters)
{
CoverType( td );
}
GenericParameterDefinition[] parametersDefinition = gc.ParametersDefinition;
if(parametersDefinition != null)
{
for(int i = 0; i < parametersDefinition.Length; i++)
{
foreach(TypeRepresentation constraint in parametersDefinition[i].Constraints)
{
CoverType( constraint );
}
}
}
}
CoverType( md.OwnerType );
CoverType( md.ReturnType );
foreach(TypeRepresentation td in md.ThisPlusArguments)
{
CoverType( td );
}
///
/// For imported methods we need to make sure that any passed structures are preserved.
/// The type system reduction phase will attempt to remove member fields if they are
/// not used or covered here which will leave them with a different signature/size than
/// the native imported method is expecting.
///
if(0 != ( md.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Imported ))
{
foreach(CustomAttributeAssociationRepresentation caa in md.CustomAttributes)
{
CoverCustomAttributeAssociation( caa );
}
HashSet importTypes = new HashSet();
foreach(TypeRepresentation tr in md.ThisPlusArguments)
{
// Make imported structures do not lose members during type system reduction
if(
tr.BuiltInType == TypeRepresentation.BuiltInTypes.BYREF &&
tr.UnderlyingType.BuiltInType == TypeRepresentation.BuiltInTypes.VALUETYPE )
{
CoverImportedDataType( tr.UnderlyingType, importTypes );
}
// also check for arrays of structs
else if(
tr.BuiltInType == TypeRepresentation.BuiltInTypes.ARRAY &&
tr.ContainedType.BuiltInType == TypeRepresentation.BuiltInTypes.VALUETYPE )
{
CoverImportedDataType( tr.ContainedType, importTypes );
}
}
}
}
///
/// Cover all fields from an imported structure so that its size/signature remains consistent.
///
///
///
private void CoverImportedDataType( TypeRepresentation tr, HashSet coveredTypes )
{
if(coveredTypes.Contains( tr )) return;
coveredTypes.Add( tr );
CoverType( tr );
foreach(FieldRepresentation fr in tr.Fields)
{
CoverField( fr );
CoverImportedDataType( fr.FieldType, coveredTypes );
}
}
private void CoverCustomAttribute( CustomAttributeRepresentation ca )
{
if(ca == null) return;
if(m_reachabilitySet.ExpandPending( ca ))
{
return;
}
CoverReflectionType( ca );
CoverMethod( ca.Constructor );
}
private void CoverCustomAttributeAssociation( CustomAttributeAssociationRepresentation caa )
{
if(caa == null) return;
if(m_reachabilitySet.ExpandPending( caa ))
{
return;
}
CoverReflectionType( caa );
CoverObject( caa.Target );
CoverObject( caa.CustomAttribute );
}
//--//
internal void IncludeGeneric( object obj )
{
CHECKS.ASSERT( m_owner.m_typeSystem.IsUseProhibited( obj ) == false, "Found use of '{0}' after the entity was marked illegal to use", obj );
if(obj is TypeRepresentation)
{
Include( (TypeRepresentation)obj );
}
else if(obj is TypeRepresentation.GenericContext)
{
Include( (TypeRepresentation.GenericContext)obj );
}
else if(obj is FieldRepresentation)
{
Include( (FieldRepresentation)obj );
}
else if(obj is MethodRepresentation)
{
Include( (MethodRepresentation)obj );
}
else if(obj is MethodRepresentation.GenericContext)
{
Include( (MethodRepresentation.GenericContext)obj );
}
else if(obj is CustomAttributeRepresentation)
{
Include( (CustomAttributeRepresentation)obj );
}
else if(obj is VTable)
{
Include( (VTable)obj );
}
else if(obj is DataManager.DataDescriptor)
{
Include( (DataManager.DataDescriptor)obj );
}
}
private void Include( TypeRepresentation td )
{
CHECKS.ASSERT( m_owner.m_typeSystem.IsUseProhibited( td ) == false, "Found use of '{0}' after the entity was marked illegal to use", td );
CoverType( td );
//--//
TypeRepresentation tdSystem_Attribute = m_owner.m_typeSystem.WellKnownTypes.System_Attribute;
if(tdSystem_Attribute != null && tdSystem_Attribute.IsSuperClassOf( td, null ))
{
//
// If we touch an attribute, make sure all the constructor methods used by actual instances are touched.
//
m_owner.m_typeSystem.EnumerateCustomAttributes( delegate( CustomAttributeAssociationRepresentation caa )
{
CustomAttributeRepresentation ca = caa.CustomAttribute;
MethodRepresentation mdCa = ca .Constructor;
if(mdCa.OwnerType == td)
{
//
// BUGBUG: The named arguments are not included!
//
if(m_reachabilitySet.Contains( mdCa ) == false)
{
CoverMethod( mdCa );
}
}
} );
}
//--//
//
// Include all the concrete subclasses, because we need at least one implementation.
//
if(td.HasBuildTimeFlag( TypeRepresentation.BuildTimeAttributes.ForceDevirtualization ))
{
var list = m_owner.m_typeSystem.CollectConcreteImplementations(td);
foreach (var td2 in list)
{
CoverType(td2);
}
}
//--//
//
// Since call closure has reached a new type, make sure that all the overrides to already touched virtual methods are included.
//
foreach(MethodRepresentation md in td.Methods)
{
if(md is VirtualMethodRepresentation && md.IsOpenMethod == false && td.IsOpenType == false && m_reachabilitySet.Contains( md ) == false)
{
int index = md.FindVirtualTableIndex();
if(index == -1)
{
continue;
}
MethodRepresentation mdRoot = md;
TypeRepresentation tdRoot = td;
while((mdRoot.Flags & MethodRepresentation.Attributes.NewSlot) == 0)
{
tdRoot = tdRoot.Extends; if(tdRoot == null) break;
mdRoot = tdRoot.MethodTable[index];
if(m_reachabilitySet.Contains( mdRoot ))
{
CoverMethod( md );
break;
}
}
}
}
//
// Also, include the methods associated with already touched interfaces.
//
foreach(TypeRepresentation.InterfaceMap map in td.InterfaceMaps)
{
if(m_reachabilitySet.Contains( map.Interface ))
{
MethodRepresentation[] mdOverride = map.Methods;
MethodRepresentation[] mdDeclaration = map.Interface.FindInterfaceTable( map.Interface );
for(int i = 0; i < mdDeclaration.Length; i++)
{
if(m_reachabilitySet.Contains( mdDeclaration[i] ))
{
if(m_reachabilitySet.Contains( mdOverride[i] ) == false)
{
CoverMethod( mdOverride[i] );
}
}
}
}
}
}
private void Include( TypeRepresentation.GenericContext ctx )
{
if(ctx.Template != null)
{
Include( ctx.Template );
}
foreach(TypeRepresentation td in ctx.Parameters)
{
Include( td );
}
if(ctx.ParametersDefinition != null)
{
foreach(GenericParameterDefinition def in ctx.ParametersDefinition)
{
foreach(TypeRepresentation td in def.Constraints)
{
Include( td );
}
}
}
}
private void Include( FieldRepresentation fd )
{
CHECKS.ASSERT( m_reachabilitySet.Contains( fd.OwnerType ), "ComputeCallsClosure.GlobalReachabilitySet does not contain '{0}', although it should", fd.OwnerType );
CoverField( fd );
}
private void Include( MethodRepresentation md )
{
CHECKS.ASSERT( m_owner.m_typeSystem.IsUseProhibited( md ) == false, "Found use of '{0}' after the entity was marked illegal to use", md );
CHECKS.ASSERT( m_owner.m_pendingHistory.Contains( md ), "ComputeCallsClosure.EntitiesReferencedByMethod does not contain '{0}', although it should", md );
CHECKS.ASSERT( m_reachabilitySet.Contains( md.OwnerType ), "ComputeCallsClosure.GlobalReachabilitySet does not contain '{0}', although it should", md.OwnerType );
CoverMethod( md );
if(md is VirtualMethodRepresentation && !(md is FinalMethodRepresentation))
{
//
// Include all the overrides for this method in all the subclasses already reached by the closure computation.
//
int index = md.FindVirtualTableIndex();
TypeRepresentation td = md.OwnerType;
List< TypeRepresentation > lst;
if(m_owner.m_typeSystem.DirectDescendant.TryGetValue( td, out lst ))
{
foreach(TypeRepresentation td2 in lst)
{
MethodRepresentation md2 = td2.MethodTable[index];
if(m_reachabilitySet.Contains( md2.OwnerType ))
{
CoverMethod( md2 );
}
}
}
//
// A virtual method defines a slot when it's first introduced.
// Make sure all the methods from this one up to the root of the override tree are included.
//
MethodRepresentation mdRoot = md;
while((mdRoot.Flags & MethodRepresentation.Attributes.NewSlot) == 0)
{
td = td.Extends; if(td == null) break;
mdRoot = td.MethodTable[index];
if(m_reachabilitySet.Contains( mdRoot ) == false)
{
CoverMethod( mdRoot );
}
}
//--//
//
// The method belongs to an interface, we have to include all the implementations in all the touched types.
//
if(td is InterfaceTypeRepresentation)
{
InterfaceTypeRepresentation itf = (InterfaceTypeRepresentation)td;
int itfIndex = md.FindInterfaceTableIndex();
foreach(TypeRepresentation td2 in m_owner.m_typeSystem.InterfaceImplementors[itf])
{
if(m_reachabilitySet.Contains( td2 ))
{
MethodRepresentation mdOverride = td2.FindInterfaceTable( itf )[itfIndex];
if(m_reachabilitySet.Contains( mdOverride ) == false)
{
CoverMethod( mdOverride );
}
}
}
}
}
}
private void Include( MethodRepresentation.GenericContext ctx )
{
Include( ctx.Template );
foreach(TypeRepresentation td in ctx.Parameters)
{
Include( td );
}
if(ctx.ParametersDefinition != null)
{
foreach(GenericParameterDefinition def in ctx.ParametersDefinition)
{
foreach(TypeRepresentation td in def.Constraints)
{
Include( td );
}
}
}
}
private void Include( CustomAttributeRepresentation ca )
{
CHECKS.ASSERT( m_owner.m_typeSystem.IsUseProhibited( ca ) == false, "Found use of '{0}' after the entity was marked illegal to use", ca );
CoverCustomAttribute( ca );
}
private void Include( VTable vTable )
{
Include( vTable.TypeInfo );
}
private void Include( DataManager.DataDescriptor dd )
{
lock(m_owner.m_delayedExpansion)
{
m_owner.m_delayedExpansion.Insert( dd );
}
}
internal bool Contains( object obj )
{
return m_reachabilitySet.Contains( obj );
}
//--//
//
// Access Methods
//
public TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_owner.m_typeSystem;
}
}
internal TypeSystem.Reachability ReachabilitySet
{
get
{
return m_reachabilitySet;
}
}
}
//
// State
//
private readonly TypeSystemForCodeTransformation m_typeSystem;
private readonly CallsDataBase m_callsDatabase;
private readonly PhaseDriver m_phase;
private readonly GrowOnlyHashTable< Type, List< Notification > > m_delegation;
private readonly GrowOnlySet < DataManager.DataDescriptor > m_delayedExpansion;
private readonly GrowOnlySet < MethodRepresentation > m_pendingHistory;
private readonly Queue < MethodRepresentation > m_pending;
private readonly Context m_globalContext;
private readonly GrowOnlyHashTable< MethodRepresentation, GrowOnlySet< object > > m_entitiesReferencedByMethods;
//
// Constructor Methods
//
public ComputeCallsClosure( TypeSystemForCodeTransformation typeSystem ,
DelegationCache cache ,
CallsDataBase callsDatabase ,
PhaseDriver phase ,
bool fCollectPerMethodInfo )
{
m_typeSystem = typeSystem;
m_callsDatabase = callsDatabase;
m_phase = phase;
m_delegation = HashTableFactory.New < Type, List< Notification > >();
m_delayedExpansion = SetFactory .NewWithReferenceEquality< DataManager.DataDescriptor >();
m_pendingHistory = SetFactory .NewWithReferenceEquality< MethodRepresentation >();
m_pending = new Queue < MethodRepresentation >();
m_globalContext = new Context( this, typeSystem.ReachabilitySet );
if(fCollectPerMethodInfo)
{
m_entitiesReferencedByMethods = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, GrowOnlySet< object > >();
}
typeSystem.ReachabilitySet.RestartComputation();
cache.HookNotifications( typeSystem, this, phase );
}
//
// Helper Methods
//
public void Execute( MethodRepresentation mdStart )
{
if(m_globalContext.Contains( mdStart ) == false)
{
QueueMethodForProcessing( mdStart );
ProcessInner();
}
}
public void Expand( object val )
{
m_globalContext.CoverObject( val );
ProcessInner();
}
public void ExpandContents< TKey, TValue >( GrowOnlyHashTable< TKey, TValue > ht )
{
foreach(TKey key in ht.Keys)
{
Expand( key );
Expand( ht[key] );
}
}
public void ExpandValueIfKeyIsReachable< TKey, TValue >( GrowOnlyHashTable< TKey, TValue > ht )
{
foreach(TKey key in ht.Keys)
{
if(m_globalContext.Contains( key ))
{
Expand( ht[key] );
}
}
}
//--//
private void QueueMethodForProcessing( MethodRepresentation md )
{
lock(m_pendingHistory)
{
if(m_pendingHistory.Insert( md ) == true)
{
return;
}
}
lock(m_pending)
{
m_pending.Enqueue( md );
}
}
private void ProcessInner()
{
while(IsThereWorkToDo())
{
ProcessMethods();
ProcessDataDescriptors();
}
}
private bool IsThereWorkToDo()
{
if(m_pending.Count > 0)
{
return true;
}
if(m_globalContext.ReachabilitySet.HasPendingItems())
{
return true;
}
return false;
}
private void Analyze( MethodRepresentation md )
{
m_globalContext.ProcessMethod( md );
if(m_entitiesReferencedByMethods != null)
{
GrowOnlySet< object > entitiesReferencedByMethod;
lock(m_entitiesReferencedByMethods)
{
if(m_entitiesReferencedByMethods.ContainsKey( md )) return;
entitiesReferencedByMethod = SetFactory.NewWithWeakEquality< object >();
m_entitiesReferencedByMethods[md] = entitiesReferencedByMethod;
}
var currentMethodReachabilitySet = TypeSystemForCodeTransformation.Reachability.CreateForUpdate( entitiesReferencedByMethod );
Context ctx = new Context( this, currentMethodReachabilitySet );
ctx.ProcessMethod( md );
}
}
private void ProcessMethods()
{
using(ParallelTransformationsHandler handler = new ParallelTransformationsHandler( Analyze ))
{
while(true)
{
DrainIncrementalSet();
if(m_pending.Count == 0)
{
break;
}
var methods = m_pending.ToArray();
m_pending.Clear();
#if COMPUTECALLSCLOSURE_FORCE_SINGLE_THREADED
foreach(var md in methods)
{
Analyze( md );
}
#else
foreach(var md in methods)
{
handler.Queue( md );
}
handler.Synchronize();
#endif
}
}
}
private void DrainIncrementalSet()
{
while(true)
{
object[] set = m_globalContext.ReachabilitySet.ApplyPendingSet( true );
if(set == null)
{
break;
}
foreach(object obj in set)
{
m_globalContext.IncludeGeneric( obj );
}
}
}
private void ProcessDataDescriptors()
{
TypeSystem.Reachability reachability = m_globalContext.ReachabilitySet.CloneForIncrementalUpdate();
foreach(DataManager.DataDescriptor dd in m_delayedExpansion)
{
if(reachability.Contains( dd ))
{
dd.IncludeExtraTypes( reachability, m_phase );
}
}
object[] set = reachability.ApplyPendingSet( false );
if(set != null)
{
foreach(object obj in set)
{
m_globalContext.CoverObject( obj );
}
}
}
//--//
public void RegisterForNotification( Type type ,
Notification notification )
{
HashTableWithListFactory.AddUnique( m_delegation, type, notification );
}
//--//
//
// Access Methods
//
public TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_typeSystem;
}
}
public GrowOnlyHashTable< MethodRepresentation, GrowOnlySet< object > > EntitiesReferencedByMethods
{
get
{
return m_entitiesReferencedByMethods;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/DelegationCache.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class DelegationCache
{
class Entry
{
//
// State
//
System.Reflection.MethodInfo m_source;
Delegate m_dlg;
AbstractHandlerAttribute m_context;
PhaseFilterAttribute[] m_phaseFilters;
//
// Constructor Methods
//
internal Entry( System.Reflection.MethodInfo source ,
Delegate dlg ,
AbstractHandlerAttribute context )
{
m_source = source;
m_dlg = dlg;
m_context = context;
m_phaseFilters = ReflectionHelper.GetAttributes< PhaseFilterAttribute >( source, false );
}
//
// Helper Methods
//
internal bool ShouldProcess( PhaseDriver phase ,
int pass )
{
if(pass == 0)
{
foreach(PhaseFilterAttribute pf in m_phaseFilters)
{
if(pf.Target == phase.GetType())
{
return true;
}
}
}
else
{
if(m_phaseFilters.Length == 0)
{
//
// No filter => always on. But process after any entry that has a filter.
//
return true;
}
}
return false;
}
//
// Access Methods
//
internal System.Reflection.MethodInfo Source
{
get
{
return m_source;
}
}
internal PhaseDriver.Notification DelegateForPhase
{
get
{
return (PhaseDriver.Notification)m_dlg;
}
}
internal PhaseExecution.NotificationOfTransformation DelegateForPhaseExecution
{
get
{
return (PhaseExecution.NotificationOfTransformation)m_dlg;
}
}
internal PhaseExecution.NotificationOfTransformationForAttribute DelegateForPhaseExecutionForAttribute
{
get
{
return (PhaseExecution.NotificationOfTransformationForAttribute)m_dlg;
}
}
internal ComputeCallsClosure.Notification DelegateForCallClosure
{
get
{
return (ComputeCallsClosure.Notification)m_dlg;
}
}
internal AbstractHandlerAttribute Context
{
get
{
return m_context;
}
}
}
//
// State
//
private readonly TypeSystemForCodeTransformation m_typeSystem;
private List< Entry > m_entries;
//
// Constructor Methods
//
public DelegationCache( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
m_entries = new List< Entry >();
}
//
// Helper Methods
//
public void Register( object instance )
{
Type t = instance.GetType();
while(t != null)
{
foreach(var mi in t.GetMethods( System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic ))
{
HookCustomAttributeNotifications( mi, instance );
HookNewEntityNotifications ( mi, instance );
CreateHandlers ( mi, instance );
}
var cfgProv = m_typeSystem.GetEnvironmentService< IConfigurationProvider >();
if(cfgProv != null)
{
foreach(var mi in ReflectionHelper.GetAllFields( t ))
{
foreach(var attr in ReflectionHelper.GetAttributes< Runtime.ConfigurationOptionAttribute >( mi, false ))
{
object val;
if(cfgProv.GetValue( attr.Name, out val ))
{
if(mi.IsStatic)
{
mi.SetValue( null, val );
}
else
{
mi.SetValue( instance, val );
}
}
}
}
}
t = t.BaseType;
}
}
private void CreateHandlers( System.Reflection.MethodInfo mi ,
object instance )
{
foreach(AbstractHandlerAttribute attrib in ReflectionHelper.GetAttributes< AbstractHandlerAttribute >( mi, false ))
{
try
{
Type type;
if(attrib is CallClosureHandlerAttribute)
{
type = typeof(ComputeCallsClosure.Notification);
}
else if(attrib is PrePhaseHandlerAttribute ||
attrib is PostPhaseHandlerAttribute )
{
type = typeof(PhaseDriver.Notification);
}
else if(attrib is CustomAttributeHandlerAttribute)
{
type = typeof(PhaseExecution.NotificationOfTransformationForAttribute);
}
else
{
type = typeof(PhaseExecution.NotificationOfTransformation);
}
Entry en = new Entry( mi, CreateNotification( type, mi, instance ), attrib );
m_entries.Add( en );
}
catch(Exception ex)
{
throw TypeConsistencyErrorException.Create( "Got the following error while trying to create a notification handler for {0}:\n{1}", attrib, ex.ToString() );
}
}
}
private void HookNewEntityNotifications( System.Reflection.MethodInfo mi ,
object instance )
{
if(ReflectionHelper.HasAttribute< CompilationSteps.NewEntityNotificationAttribute >( mi, false ))
{
System.Reflection.ParameterInfo[] parameters = mi.GetParameters();
if(parameters != null && parameters.Length == 1)
{
Type paramEntity = parameters[0].ParameterType;
if(paramEntity == typeof(TypeRepresentation))
{
var dlg = (TypeSystem.NotificationOfNewType)CreateNotification( typeof(TypeSystem.NotificationOfNewType), mi, instance );
m_typeSystem.RegisterForNewType( dlg );
return;
}
if(paramEntity == typeof(FieldRepresentation))
{
var dlg = (TypeSystem.NotificationOfNewField)CreateNotification( typeof(TypeSystem.NotificationOfNewField), mi, instance );
m_typeSystem.RegisterForNewField( dlg );
return;
}
if(paramEntity == typeof(MethodRepresentation))
{
var dlg = (TypeSystem.NotificationOfNewMethod)CreateNotification( typeof(TypeSystem.NotificationOfNewMethod), mi, instance );
m_typeSystem.RegisterForNewMethod( dlg );
return;
}
}
throw TypeConsistencyErrorException.Create( "Method '{0}' cannot be used for new entity notification", mi );
}
}
//--//
private void HookCustomAttributeNotifications( System.Reflection.MethodInfo mi ,
object instance )
{
foreach(var attrib in ReflectionHelper.GetAttributes< CompilationSteps.CustomAttributeNotificationAttribute >( mi, false ))
{
TypeRepresentation td = m_typeSystem.GetWellKnownTypeNoThrow( attrib.Target );
if(td == null)
{
throw TypeConsistencyErrorException.Create( "Failed to create custom attribute notification because type '{0}' is not well-known", attrib.Target );
}
System.Reflection.ParameterInfo[] parameters = mi.GetParameters();
if(parameters != null && parameters.Length >= 3)
{
Type paramTypeKeep = parameters[0].ParameterType;
Type paramTypeCa = parameters[1].ParameterType;
Type paramTypeOwner = parameters[2].ParameterType;
if(paramTypeKeep.IsByRef && paramTypeKeep.GetElementType() == typeof(bool) &&
paramTypeCa == typeof(CustomAttributeRepresentation) )
{
if(paramTypeOwner == typeof(BaseRepresentation) && parameters.Length == 3)
{
var dlg = (TypeSystem.NotificationOfAttributeOnGeneric)CreateNotification( typeof(TypeSystem.NotificationOfAttributeOnGeneric), mi, instance );
m_typeSystem.RegisterForNotificationOfAttributeOnGeneric( td, dlg );
continue;
}
if(paramTypeOwner == typeof(TypeRepresentation) && parameters.Length == 3)
{
var dlg = (TypeSystem.NotificationOfAttributeOnType)CreateNotification( typeof(TypeSystem.NotificationOfAttributeOnType), mi, instance );
m_typeSystem.RegisterForNotificationOfAttributeOnType( td, dlg );
continue;
}
if(paramTypeOwner == typeof(FieldRepresentation) && parameters.Length == 3)
{
var dlg = (TypeSystem.NotificationOfAttributeOnField)CreateNotification( typeof(TypeSystem.NotificationOfAttributeOnField), mi, instance );
m_typeSystem.RegisterForNotificationOfAttributeOnField( td, dlg );
continue;
}
if(paramTypeOwner == typeof(MethodRepresentation))
{
if(parameters.Length == 3)
{
var dlg = (TypeSystem.NotificationOfAttributeOnMethod)CreateNotification( typeof(TypeSystem.NotificationOfAttributeOnMethod), mi, instance );
m_typeSystem.RegisterForNotificationOfAttributeOnMethod( td, dlg );
continue;
}
if(parameters.Length == 4 && parameters[3].ParameterType == typeof(int))
{
var dlg = (TypeSystem.NotificationOfAttributeOnParam)CreateNotification( typeof(TypeSystem.NotificationOfAttributeOnParam), mi, instance );
m_typeSystem.RegisterForNotificationOfAttributeOnParam( td, dlg );
continue;
}
}
}
}
throw TypeConsistencyErrorException.Create( "Method '{0}' cannot be used for custom attribute notification", mi );
}
}
//--//
public void HookNotifications( TypeSystemForCodeTransformation typeSystem ,
PhaseDriver phase )
{
for(int pass = 0; pass < 2; pass++)
{
foreach(Entry en in m_entries)
{
if(en.ShouldProcess( phase, pass ))
{
if(en.Context is PrePhaseHandlerAttribute)
{
phase.RegisterForNotification( en.DelegateForPhase, true );
}
if(en.Context is PostPhaseHandlerAttribute)
{
phase.RegisterForNotification( en.DelegateForPhase, false );
}
}
}
}
}
public void HookNotifications( TypeSystemForCodeTransformation typeSystem ,
PhaseExecution pe ,
PhaseDriver phase )
{
for(int pass = 0; pass < 2; pass++)
{
foreach(Entry en in m_entries)
{
if(en.ShouldProcess( phase, pass ))
{
if(en.Context is OptimizationHandlerAttribute)
{
OptimizationHandlerAttribute ca = (OptimizationHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOptimization( ca, en.DelegateForPhaseExecution );
}
if(en.Context is PreFlowGraphHandlerAttribute)
{
pe.RegisterForNotificationOfFlowGraph( en.DelegateForPhaseExecution, true );
}
if(en.Context is PostFlowGraphHandlerAttribute)
{
pe.RegisterForNotificationOfFlowGraph( en.DelegateForPhaseExecution, false );
}
if(en.Context is OperatorHandlerAttribute)
{
OperatorHandlerAttribute ca = (OperatorHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOperatorsByType( ca.Target, en.DelegateForPhaseExecution );
}
if(en.Context is OperatorArgumentHandlerAttribute)
{
OperatorArgumentHandlerAttribute ca = (OperatorArgumentHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOperatorByTypeOfArguments( ca.Target, en.DelegateForPhaseExecution );
}
if(en.Context is WellKnownTypeHandlerAttribute)
{
WellKnownTypeHandlerAttribute ca = (WellKnownTypeHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOperatorByEntities( typeSystem.GetWellKnownTypeNoThrow( ca.Target ), en.DelegateForPhaseExecution );
}
if(en.Context is WellKnownFieldHandlerAttribute)
{
WellKnownFieldHandlerAttribute ca = (WellKnownFieldHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOperatorByEntities( typeSystem.GetWellKnownFieldNoThrow( ca.Target ), en.DelegateForPhaseExecution );
}
if(en.Context is WellKnownMethodHandlerAttribute)
{
WellKnownMethodHandlerAttribute ca = (WellKnownMethodHandlerAttribute)en.Context;
pe.RegisterForNotificationOfOperatorByEntities( typeSystem.GetWellKnownMethodNoThrow( ca.Target ), en.DelegateForPhaseExecution );
}
if(en.Context is CallToWellKnownMethodHandlerAttribute)
{
CallToWellKnownMethodHandlerAttribute ca = (CallToWellKnownMethodHandlerAttribute)en.Context;
pe.RegisterForNotificationOfCallOperatorByEntities( typeSystem.GetWellKnownMethodNoThrow( ca.Target ), en.DelegateForPhaseExecution );
}
if(en.Context is CustomAttributeHandlerAttribute)
{
CustomAttributeHandlerAttribute ca = (CustomAttributeHandlerAttribute)en.Context;
TypeRepresentation targetType = typeSystem.GetWellKnownTypeNoThrow( ca.FieldName );
if(targetType != null)
{
var dlg = en.DelegateForPhaseExecutionForAttribute;
typeSystem.EnumerateCustomAttributes( delegate( CustomAttributeAssociationRepresentation caa )
{
if(caa.CustomAttribute.Constructor.OwnerType == targetType)
{
BaseRepresentation bdTarget = caa.Target;
if(bdTarget != null)
{
pe.RegisterForNotificationOfOperatorByEntities( bdTarget, nc => dlg( nc, caa.CustomAttribute ) );
}
}
} );
}
}
}
}
}
}
internal void HookNotifications( TypeSystemForCodeTransformation typeSystem ,
ComputeCallsClosure cc ,
PhaseDriver phase )
{
for(int pass = 0; pass < 2; pass++)
{
foreach(Entry en in m_entries)
{
if(en.ShouldProcess( phase, pass ))
{
if(en.Context is CallClosureHandlerAttribute)
{
CallClosureHandlerAttribute ca = (CallClosureHandlerAttribute)en.Context;
cc.RegisterForNotification( ca.Target, en.DelegateForCallClosure );
}
}
}
}
}
//--//
private static Delegate CreateNotification( Type type ,
System.Reflection.MethodInfo mi ,
object instance )
{
try
{
if(mi.IsStatic)
{
return Delegate.CreateDelegate( type, mi, true );
}
else
{
return Delegate.CreateDelegate( type, instance, mi, true );
}
}
catch(Exception ex)
{
throw TypeConsistencyErrorException.Create( "Got the following error while trying to create a notification handler for {0}:\n{1}", mi, ex.ToString() );
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/DetectFieldInvariants.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
internal static class DetectFieldInvariants
{
//
// Helper Methods
//
internal static void Execute( TypeSystemForCodeTransformation typeSystem )
{
Transformations.LocateFieldsInCode lfic = new Transformations.LocateFieldsInCode( typeSystem );
lfic.Run();
foreach(FieldRepresentation fd in lfic.FieldReferences.Keys)
{
GrowOnlySet< Operator > set = lfic.FieldReferences[fd];
StoreFieldOperator opStore = null;
bool fCandidate = true;
foreach(Operator op in set)
{
if(op is StoreFieldOperator)
{
if(opStore != null)
{
//
// More than one store, let's give up.
//
// TODO: what if all the stores have the same shape?
//
fCandidate = false;
break;
}
opStore = (StoreFieldOperator)op;
}
else if(op is LoadAddressOperator)
{
//
// Address taken, not interesting.
//
fCandidate = false;
break;
}
}
if(fCandidate && opStore != null)
{
fd.Flags |= FieldRepresentation.Attributes.HasSingleAssignment;
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)opStore.BasicBlock.Owner;
MethodRepresentation md = cfg.Method;
if(fd.OwnerType != md.OwnerType)
{
continue;
}
if(md is ConstructorMethodRepresentation ||
md is StaticConstructorMethodRepresentation )
{
Expression[] rhs = opStore.Arguments;
Expression val = rhs[rhs.Length - 1];
TypeRepresentation fdType = fd.FieldType;
if(val is ConstantExpression)
{
ConstantExpression exVal = (ConstantExpression)val;
if(fdType is ReferenceTypeRepresentation)
{
if(exVal.Value != null)
{
fd.Flags |= FieldRepresentation.Attributes.NeverNull;
}
if(fdType is ArrayReferenceTypeRepresentation)
{
Array array = exVal.Value as Array;
if(array != null)
{
fd.FixedSize = array.Length;
}
}
}
}
else
{
Operator singleDef = ControlFlowGraphState.CheckSingleDefinition( cfg.DataFlow_DefinitionChains, (VariableExpression)val );
if(singleDef != null)
{
if(fdType is ArrayReferenceTypeRepresentation)
{
ArrayReferenceTypeRepresentation fdTypeArray = (ArrayReferenceTypeRepresentation)fdType;
ArrayAllocationOperator opAlloc = singleDef as ArrayAllocationOperator;
if(opAlloc != null)
{
fd.Flags |= FieldRepresentation.Attributes.NeverNull;
ConstantExpression exSize = opAlloc.FirstArgument as ConstantExpression;
long iSize;
if(exSize != null && exSize.GetAsSignedInteger( out iSize ))
{
int size = (int)iSize;
fd.FixedSize = size;
if(fd is StaticFieldRepresentation)
{
//
// This is an array assigned to a static field and never changed.
//
// Convert it into a static array, remove the array allocation and the static field assignment.
//
InstanceFieldRepresentation fdInstance = typeSystem.AddStaticFieldToGlobalRoot( (StaticFieldRepresentation)fd );
DataManager.ObjectDescriptor odRoot = typeSystem.GenerateGlobalRoot();
var wkt = typeSystem.WellKnownTypes;
TypeRepresentation tdElement = fdTypeArray.ContainedType;
Type tElement = typeSystem.TryGetTypeFromTypeRepresentation( tdElement );
Array array = null;
if(tElement != null)
{
array = Array.CreateInstance( tElement, size );
}
DataManager.Attributes flags = DataManager.Attributes.SuitableForConstantPropagation;
if(size == 0)
{
flags |= DataManager.Attributes.Constant;
}
else
{
flags |= DataManager.Attributes.Mutable;
}
Abstractions.PlacementRequirements pr = typeSystem.GetPlacementRequirements( fd );
//
// For a non-zero array, make sure it's allocated in a writable data section.
//
if(size != 0)
{
if(pr == null)
{
pr = new Abstractions.PlacementRequirements( sizeof(uint), 0 );
}
pr.AddConstraint( Runtime.MemoryUsage.DataRW );
}
DataManager.ArrayDescriptor ad = typeSystem.DataManagerInstance.BuildArrayDescriptor( fdTypeArray, flags, pr, array, size );
odRoot.Set( fdInstance, ad );
//
// Remove the store and change the allocation with a load.
//
opAlloc.SubstituteWithOperator( LoadStaticFieldOperator.New( opAlloc.DebugInfo, fd, opAlloc.FirstResult ), Operator.SubstitutionFlags.Default );
opStore.Delete();
}
}
}
}
else if(fdType is ReferenceTypeRepresentation)
{
ObjectAllocationOperator opAlloc = singleDef as ObjectAllocationOperator;
if(opAlloc != null)
{
fd.Flags |= FieldRepresentation.Attributes.NeverNull;
}
}
}
}
}
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementExternalMethods.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.CodeGeneration.IR.Abstractions;
using System.IO;
public sealed class ImplementExternalMethods
{
//
// State
//
private TypeSystemForCodeTransformation m_typeSystem;
//
// Constructor Methods
//
public ImplementExternalMethods( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
}
public static void ResetExternalDataDescriptors()
{
ExternalCallContext.Reset( );
}
//
// Helper Methods
//
public void Prepare()
{
ExternalCallContext.Initialize( m_typeSystem );
ExternalCallContext.ResetExternalCalls();
List importedMethods = new List();
foreach(TypeRepresentation td in m_typeSystem.Types)
{
//
// Implement code for external "C/ASM" calls that have been marked as imported references
//
foreach(MethodRepresentation md in td.Methods)
{
if(( md.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Exported ) != 0)
{
m_typeSystem.ExportedMethods.Add( md );
}
else if(( md.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Imported ) != 0)
{
importedMethods.Add( md );
}
}
}
foreach(MethodRepresentation md in importedMethods)
{
ImplementExternalMethodStub( md, this.m_typeSystem );
}
}
//
// Helper Methods
//
private void ImplementExternalMethodStub( MethodRepresentation md, TypeSystemForCodeTransformation typeSys )
{
ControlFlowGraphStateForCodeTransformation cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg == null)
{
cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
}
if( cfg.Method.CustomAttributes.Length > 0)
{
var bb = cfg.FirstBasicBlock;
CustomAttributeRepresentation ca = md.CustomAttributes[0].CustomAttribute;
string filePath = ca.FixedArgsValues[1] as string;
string methodName = ca.FixedArgsValues.Length >= 3 ? ca.FixedArgsValues[2] as string : md.Name;
filePath = Environment.ExpandEnvironmentVariables( filePath );
ImportedMethodReferenceAttribute.InteropFileType fileType = (ImportedMethodReferenceAttribute.InteropFileType)ca.FixedArgsValues[0];
if(!Path.IsPathRooted( filePath ))
{
string tmp = Path.Combine( Directory.GetCurrentDirectory(), filePath );
if(File.Exists( tmp ))
{
filePath = tmp;
}
else
{
foreach(string p in typeSys.NativeImportDirectories)
{
tmp = Path.Combine( p, filePath );
if(File.Exists( tmp ))
{
filePath = tmp;
break;
}
}
}
}
if(!typeSys.NativeImportLibraries.Contains( filePath.ToLower() ))
{
typeSys.NativeImportLibraries.Add( filePath.ToLower() );
}
ExternalCallOperator.IExternalCallContext[] ctxs = ExternalCallContext.Create( fileType, filePath, methodName, bb );
int len = ctxs.Length;
for(int i = 0; i < len; i++)
{
ExternalCallOperator op = ExternalCallOperator.New( ctxs[i] );
bb.AddOperator( op );
op.Context.Owner = op;
}
md.RemoveCustomAttribute( ca );
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementInternalMethods.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed partial class ImplementInternalMethods
{
internal delegate bool Callback( MethodRepresentation md );
//
// State
//
private TypeSystemForCodeTransformation m_typeSystem;
private GrowOnlyHashTable< MethodRepresentation, Callback > m_pending;
//
// Constructor Methods
//
public ImplementInternalMethods( TypeSystemForCodeTransformation typeSystem )
{
m_typeSystem = typeSystem;
m_pending = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, Callback >();
}
//
// Helper Methods
//
public void Prepare()
{
WellKnownTypes wkt = m_typeSystem.WellKnownTypes;
WellKnownMethods wkm = m_typeSystem.WellKnownMethods;
TypeRepresentation tdMulticastDelegate = wkt.System_MulticastDelegate;
MethodRepresentation mdObject_Equals = wkm.Object_Equals;
Callback dlgImplementObjectEquals = ImplementObjectEquals;
foreach(TypeRepresentation td in m_typeSystem.Types)
{
//
// For all the user-defined value types, provide a system-generated implementation of Object.Equals and Obect.GetHashCode.
//
if(td is ValueTypeRepresentation && !(td is ScalarTypeRepresentation) && td.IsAbstract == false)
{
if(td.IsOpenType == false && td.FindMatch( mdObject_Equals, null ) == null)
{
MethodRepresentation md = td.CreateOverride( m_typeSystem, (VirtualMethodRepresentation)mdObject_Equals );
m_pending[md] = dlgImplementObjectEquals;
}
}
//
// Implement code for delegates.
//
if(td.IsSubClassOf( tdMulticastDelegate, null ) && wkm.MulticastDelegateImpl_MulticastDelegateImpl != null)
{
foreach(MethodRepresentation md in td.Methods)
{
ImplementDelegateMethods( md );
}
}
//
// Implement code for the compiler-generated methods on arrays.
//
if(td is ArrayReferenceTypeRepresentation)
{
var tdHelper = FindArrayHelper( td );
foreach(MethodRepresentation md in td.Methods)
{
if(md is RuntimeMethodRepresentation)
{
if(TypeSystemForCodeTransformation.GetCodeForMethod( md ) == null)
{
var cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
if(tdHelper != null)
{
LinkArrayImplementation( cfg, tdHelper );
}
else
{
ProvideThrowingStubImplementation( cfg );
}
}
}
}
}
//LON: 2/16/09
//
// Implement code for external "C/ASM" calls that have been marked as imported references
//
foreach(MethodRepresentation md in td.Methods)
{
if ((md.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Imported) != 0)
{
ImplementExternalMethodStub( md, this.m_typeSystem );
}
}
}
//
// Implement code for singleton factories.
//
foreach(MethodRepresentation md in m_typeSystem.SingletonFactories.Keys)
{
ImplementSingletonFactory( md, m_typeSystem.SingletonFactories[md] );
}
}
private TypeRepresentation FindArrayHelper( TypeRepresentation td )
{
List< TypeRepresentation > lst;
if(m_typeSystem.GenericTypeInstantiations.TryGetValue( m_typeSystem.WellKnownTypes.Microsoft_Zelig_Runtime_SZArrayHelper, out lst ))
{
foreach(var tdHelper in lst)
{
if(tdHelper.GenericParameters[0] == td.ContainedType)
{
return tdHelper;
}
}
}
return null;
}
private void LinkArrayImplementation( ControlFlowGraphStateForCodeTransformation cfg ,
TypeRepresentation tdHelper )
{
MethodRepresentation md = cfg.Method;
TypeRepresentation[] thisPlusArguments = md.ThisPlusArguments;
thisPlusArguments = ArrayUtility.InsertAtHeadOfNotNullArray( thisPlusArguments, tdHelper );
foreach(var mdHelper in tdHelper.Methods)
{
if(mdHelper.MatchNameAndSignature( md.Name, md.ReturnType, thisPlusArguments, null ))
{
var bb = cfg.CreateFirstNormalBasicBlock();
var rhs = m_typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdHelper, cfg.Arguments );
bb.AddOperator( StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdHelper, VariableExpression.ToArray( cfg.ReturnValue ), rhs ) );
cfg.AddReturnOperator();
return;
}
}
//
// No implementation found, fallback to throwing behavior.
//
ProvideThrowingStubImplementation( cfg );
}
private void ProvideThrowingStubImplementation( ControlFlowGraphStateForCodeTransformation cfg )
{
var bb = cfg.CreateFirstNormalBasicBlock();
MethodRepresentation mdThrow = m_typeSystem.WellKnownMethods.ThreadImpl_ThrowNotImplementedException;
Expression[] rhs = m_typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdThrow );
bb.AddOperator( StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdThrow, rhs ) );
cfg.ExitBasicBlock.FlowControl = DeadControlOperator.New( null );
}
public bool Complete()
{
MethodRepresentation[] mdArray = m_pending.KeysToArray();
Callback[] dlgArray = m_pending.ValuesToArray();
bool fRes = true;
m_pending.Clear();
for(int i = 0; i < mdArray.Length; i++)
{
MethodRepresentation md = mdArray[i];
if(m_typeSystem.EstimatedReachabilitySet.IsProhibited( md ) == false)
{
fRes &= dlgArray[i]( mdArray[i] );
}
}
return fRes;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementInternalMethods_Delegate.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed partial class ImplementInternalMethods
{
//
// Helper Methods
//
private void ImplementDelegateMethods( MethodRepresentation md )
{
if(TypeSystemForCodeTransformation.GetCodeForMethod( md ) == null)
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
WellKnownTypes wkt = m_typeSystem.WellKnownTypes;
WellKnownMethods wkm = m_typeSystem.WellKnownMethods;
WellKnownFields wkf = m_typeSystem.WellKnownFields;
if(md is ConstructorMethodRepresentation)
{
var bb = cfg.CreateFirstNormalBasicBlock();
md.BuildTimeFlags &= ~MethodRepresentation.BuildTimeAttributes.Inline;
md.BuildTimeFlags |= MethodRepresentation.BuildTimeAttributes.NoInline;
//
// Create proper flow control for exit basic block.
//
cfg.AddReturnOperator();
//
// Call the base method.
//
MethodRepresentation mdParent = wkm.MulticastDelegateImpl_MulticastDelegateImpl;
Expression[] rhs = new Expression[cfg.Arguments.Length];
for(int i = 0; i < cfg.Arguments.Length; i++)
{
rhs[i] = cfg.Arguments[i];
}
// Wrap the IntPtr param in a CodePointer struct and call the parent constructor.
rhs[2] = cfg.AllocateLocal( wkt.Microsoft_Zelig_Runtime_TypeSystem_CodePointer, null );
bb.AddOperator( StoreInstanceFieldOperator.New( null, wkf.CodePointer_Target, rhs[2], cfg.Arguments[2], false ) );
bb.AddOperator( InstanceCallOperator.New( null, CallOperator.CallKind.Overridden, mdParent, rhs, true ) );
}
else if(md.Name == "Invoke")
{
var bb = cfg.CreateFirstNormalBasicBlock();
BasicBlock bbExit;
Expression[] rhs;
VariableExpression exReturnValue;
//
// Create proper flow control for exit basic block.
//
ReturnControlOperator opRet;
if(cfg.ReturnValue != null)
{
opRet = ReturnControlOperator.New( cfg.ReturnValue );
//--//
exReturnValue = cfg.AllocateLocal( cfg.ReturnValue.Type, null );
Operator op = cfg.GenerateVariableInitialization( null, exReturnValue );
cfg.GetInjectionPoint( BasicBlock.Qualifier.PrologueEnd ).AddOperator( op );
//--//
bbExit = cfg.CreateLastNormalBasicBlock();
bbExit.AddOperator( SingleAssignmentOperator.New( null, cfg.ReturnValue, exReturnValue ) );
}
else
{
opRet = ReturnControlOperator.New();
//--//
exReturnValue = null;
//--//
bbExit = cfg.NormalizedExitBasicBlock;
}
cfg.ExitBasicBlock.AddOperator( opRet );
//
// This is the code we need to implement:
//
// DelegateImpl[] invocationList = m_invocationList;
//
// if(invocationList == null)
// {
// res = Invoke( ... );
// }
// else
// {
// int len = invocationList.Length;
//
// for(int i = 0; i < len; i++)
// {
// res = invocationList[i].Invoke( ... );
// }
// }
//
//
FieldRepresentation fdInvocationList = wkf.MulticastDelegateImpl_m_invocationList;
FieldRepresentation fdTarget = wkf.DelegateImpl_m_target;
FieldRepresentation fdCodePtr = wkf.DelegateImpl_m_codePtr;
VariableExpression exInvocationList = cfg.AllocateTemporary( fdInvocationList.FieldType , null );
VariableExpression exInvocation = cfg.AllocateTemporary( fdInvocationList.FieldType.ContainedType, null );
VariableExpression exTarget = cfg.AllocateTemporary( fdTarget .FieldType , null );
VariableExpression exCodePtr = cfg.AllocateTemporary( fdCodePtr .FieldType , null );
VariableExpression exLen = cfg.AllocateTemporary( wkt.System_Int32 , null );
VariableExpression exPos = cfg.AllocateTemporary( wkt.System_Int32 , null );
VariableExpression exThis = cfg.Arguments[0];
//--//
//
// DelegateImpl[] invocationList = m_invocationList;
//
// if(invocationList == null)
// {
//
// }
// else
// {
//
// }
//
NormalBasicBlock bbNull = new NormalBasicBlock( cfg );
NormalBasicBlock bbNotNull = new NormalBasicBlock( cfg );
bb.AddOperator( LoadInstanceFieldOperator.New( null, fdInvocationList, exInvocationList, exThis, true ) );
bb.FlowControl = BinaryConditionalControlOperator.New( null, exInvocationList, bbNull, bbNotNull );
//--//
//
//
//
// {
// object target = m_target;
// CodePtr codePtr = m_codePtr;
//
// if (target != null)
// = IndirectCall(target, );
// else
// = IndirectCall();
// }
//
NormalBasicBlock bbInstance = new NormalBasicBlock(cfg);
NormalBasicBlock bbStatic = new NormalBasicBlock(cfg);
bbNull.AddOperator(LoadInstanceFieldOperator.New(null, fdTarget, exTarget, exThis, true));
bbNull.AddOperator(LoadInstanceFieldOperator.New(null, fdCodePtr, exCodePtr, exThis, true));
bbNull.FlowControl = BinaryConditionalControlOperator.New(null, exTarget, bbStatic, bbInstance);
rhs = new Expression[cfg.Arguments.Length + 1];
rhs[0] = exCodePtr;
rhs[1] = exTarget;
for(int i = 1; i < cfg.Arguments.Length; i++)
{
rhs[i+1] = cfg.Arguments[i];
}
bbInstance.AddOperator(IndirectCallOperator.New(null, md, VariableExpression.ToArray(exReturnValue), rhs, true, false));
bbInstance.AddOperator(UnconditionalControlOperator.New(null, bbExit));
bbStatic.AddOperator(IndirectCallOperator.New(null, md, VariableExpression.ToArray(exReturnValue), rhs, false, false));
bbStatic.AddOperator(UnconditionalControlOperator.New(null, bbExit));
//
//
//
// {
// int len = invocationList.Length;
//
// for(int pos = 0; pos < len; pos++)
// {
// DelegateImpl invocation = invocationList[i];
//
// res = invocation.Invoke( ... );
// }
// }
NormalBasicBlock bbNotNullCheck = new NormalBasicBlock(cfg);
NormalBasicBlock bbNotNullInner = new NormalBasicBlock(cfg);
NormalBasicBlock bbNotNullInstance = new NormalBasicBlock(cfg);
NormalBasicBlock bbNotNullStatic = new NormalBasicBlock(cfg);
NormalBasicBlock bbNotNullPost = new NormalBasicBlock(cfg);
bbNotNull.AddOperator(ArrayLengthOperator.New(null, exLen, exInvocationList));
bbNotNull.AddOperator(SingleAssignmentOperator.New(null, exPos, m_typeSystem.CreateConstant(0)));
bbNotNull.AddOperator(UnconditionalControlOperator.New(null, bbNotNullCheck));
bbNotNullCheck.AddOperator(CompareConditionalControlOperator.New(null, CompareAndSetOperator.ActionCondition.LT, true, exPos, exLen, bbExit, bbNotNullInner));
bbNotNullInner.AddOperator(LoadElementOperator.New(null, exInvocation, exInvocationList, exPos, null, true));
bbNotNullInner.AddOperator(LoadInstanceFieldOperator.New(null, fdTarget, exTarget, exInvocation, true));
bbNotNullInner.AddOperator(LoadInstanceFieldOperator.New(null, fdCodePtr, exCodePtr, exInvocation, true));
rhs = new Expression[cfg.Arguments.Length + 1];
rhs[0] = exCodePtr;
rhs[1] = exTarget;
for (int i = 1; i < cfg.Arguments.Length; i++)
{
rhs[i+1] = cfg.Arguments[i];
}
bbNotNullInner.FlowControl = BinaryConditionalControlOperator.New(null, exTarget, bbNotNullStatic, bbNotNullInstance);
bbNotNullInstance.AddOperator(IndirectCallOperator.New(null, md, VariableExpression.ToArray(exReturnValue), rhs, true, false));
bbNotNullInstance.AddOperator(UnconditionalControlOperator.New(null, bbNotNullPost));
bbNotNullStatic.AddOperator(IndirectCallOperator.New(null, md, VariableExpression.ToArray(exReturnValue), rhs, false, false));
bbNotNullStatic.AddOperator(UnconditionalControlOperator.New(null, bbNotNullPost));
bbNotNullPost.AddOperator(BinaryOperator.New(null, BinaryOperator.ALU.ADD, true, false, exPos, exPos, m_typeSystem.CreateConstant(1)));
bbNotNullPost.AddOperator(UnconditionalControlOperator.New(null, bbNotNullCheck));
}
else
{
var bb = cfg.CreateFirstNormalBasicBlock();
MethodRepresentation mdThrow = wkm.ThreadImpl_ThrowNotImplementedException;
Expression[] rhs = m_typeSystem.AddTypePointerToArgumentsOfStaticMethod( mdThrow );
bb.AddOperator( StaticCallOperator.New( null, CallOperator.CallKind.Direct, mdThrow, rhs ) );
cfg.ExitBasicBlock.AddOperator( DeadControlOperator.New( null ) );
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementInternalMethods_ExternalMethodStub.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
using Microsoft.Zelig.Runtime;
using Microsoft.Zelig.CodeGeneration.IR.Abstractions;
public sealed partial class ImplementInternalMethods
{
//
// Helper Methods
//
public static void InitializeExternalReferences()
{
ExternalCallContext.Reset();
}
private void ImplementExternalMethodStub( MethodRepresentation md, TypeSystemForCodeTransformation typeSys )
{
if (TypeSystemForCodeTransformation.GetCodeForMethod(md) == null)
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
var bb = cfg.CreateFirstNormalBasicBlock();
///
/// Leave an empty implemenation that will be filled only after the ComputeCallClosure phase is over. That way
/// we do not add imported code that will not be used.
///
//
// Create proper flow control for exit basic block.
//
cfg.AddReturnOperator();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementInternalMethods_ObjectEquals.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed partial class ImplementInternalMethods
{
//
// Helper Methods
//
private bool ImplementObjectEquals( MethodRepresentation md )
{
if(TypeSystemForCodeTransformation.GetCodeForMethod( md ) == null)
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
var bb = cfg.CreateFirstNormalBasicBlock();
var bbExit = cfg.NormalizedExitBasicBlock;
NormalBasicBlock bbTRUE = new NormalBasicBlock( cfg );
NormalBasicBlock bbFALSE = new NormalBasicBlock( cfg );
NormalBasicBlock bbNext;
VariableExpression variable_return = cfg.ReturnValue;
VariableExpression pThis = cfg.Arguments[0];
VariableExpression obj = cfg.Arguments[1];
TemporaryVariableExpression other;
//
// Create proper flow control for exit basic block.
//
cfg.AddReturnOperator();
//
// Create TRUE branch.
//
bbTRUE.AddOperator( SingleAssignmentOperator .New( null, variable_return, m_typeSystem.CreateConstant( md.ReturnType, 1 ) ) );
bbTRUE.AddOperator( UnconditionalControlOperator.New( null, bbExit ) );
//
// Create FALSE branch.
//
bbFALSE.AddOperator( SingleAssignmentOperator .New( null, variable_return, m_typeSystem.CreateConstant( md.ReturnType, 0 ) ) );
bbFALSE.AddOperator( UnconditionalControlOperator.New( null, bbExit ) );
//// ;;;91 if(!(obj is T))
//// ;;;91 ^
//// Op_4 : $other = Arg_1(obj) isinst BoxedValueTypeRepresentation(T)
//// Op_6 : if $other != ZERO then goto $Next else goto $Label_FALSE
////
bbNext = new NormalBasicBlock( cfg );
other = cfg.AllocateTemporary( pThis.Type, null );
bb.AddOperator( IsInstanceOperator.New( null, pThis.Type, other, obj ) );
bb.FlowControl = BinaryConditionalControlOperator.New( null, other, bbFALSE, bbNext );
bb = bbNext;
foreach(FieldRepresentation fd in md.OwnerType.Fields)
{
if(fd is InstanceFieldRepresentation)
{
TypeRepresentation fdType = fd.FieldType;
bbNext = new NormalBasicBlock( cfg );
if(fdType is ScalarTypeRepresentation ||
fdType is ReferenceTypeRepresentation ||
fdType is PointerTypeRepresentation )
{
//// $pThisField <= [Arg_0(this), InstanceFieldRepresentation(fd)]
//// $otherField <= [$other, InstanceFieldRepresentation(fd)]
//// if $pThisField EQ.unsigned $otherField then goto $Label_FALSE else goto $Next
TemporaryVariableExpression pThisField = cfg.AllocateTemporary( fdType, null );
TemporaryVariableExpression otherField = cfg.AllocateTemporary( fdType, null );
bb.AddOperator( LoadInstanceFieldOperator.New( null, fd, pThisField, pThis, true ) );
bb.AddOperator( LoadInstanceFieldOperator.New( null, fd, otherField, other, true ) );
bb.AddOperator( CompareConditionalControlOperator.New( null, CompareAndSetOperator.ActionCondition.EQ, false, pThisField, otherField, bbFALSE, bbNext ) );
}
//// else if(fdType is ValueTypeRepresentation)
//// {
//// ManagedPointerTypeRepresentation fdTypeAddr = m_typeSystem.GetManagedPointerToType( fdType );
//// TemporaryVariableExpression tmp = cfg.AllocateTemporary( m_typeSystem.WellKnownTypes.System_Int32 );
//// TemporaryVariableExpression pThisFieldAddr = cfg.AllocateTemporary( fdTypeAddr );
//// TemporaryVariableExpression otherFieldAddr = cfg.AllocateTemporary( fdTypeAddr );
////
//// bb.AddOperator( LoadInstanceFieldAddressOperator.New( null, fd, pThisFieldAddr, pThis ) );
//// bb.AddOperator( LoadInstanceFieldAddressOperator.New( null, fd, otherFieldAddr, other ) );
////
//// bb.AddOperator( InstanceCallOperator.New( null, CallOperator.CallKind.Virtual, m_typeSystem.WellKnownMethods.Object_Equals, tmp, new Expression[] { pThisFieldAddr, otherFieldAddr } ) );
//// bb.AddOperator( BinaryConditionalControlOperator.New( null, tmp, bbFALSE, bbNext ) );
//// }
else
{
bb.AddOperator( UnconditionalControlOperator.New( null, bbNext ) );
//throw TypeConsistencyErrorException.Create( "Don't know how to generate comparison code for field {0}", fd );
}
bb = bbNext;
}
}
bb.AddOperator( UnconditionalControlOperator.New( null, bbTRUE ) );
return false;
}
return true;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ImplementInternalMethods_SingletonFactory.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed partial class ImplementInternalMethods
{
//
// Helper Methods
//
private void ImplementSingletonFactory( MethodRepresentation md ,
CustomAttributeRepresentation ca )
{
if(TypeSystemForCodeTransformation.GetCodeForMethod( md ) == null)
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_typeSystem.CreateControlFlowGraphState( md );
VariableExpression dst = cfg.ReturnValue;
TypeRepresentation target = dst.Type;
if((target.Flags & TypeRepresentation.Attributes.Sealed) == 0)
{
TypeRepresentation targetDirect;
if(m_typeSystem.ForcedDevirtualizations.TryGetValue( target, out targetDirect ))
{
target = targetDirect;
}
else
{
//
// BUGBUG: This is valid only if we are in bounded application mode!!!
//
List< TypeRepresentation > lst = m_typeSystem.CollectConcreteImplementations( target );
switch(lst.Count)
{
case 0:
throw TypeConsistencyErrorException.Create( "Found singleton factory that refers to a type with no concrete subclasses: {0}", target.FullName );
case 1:
target = lst[ 0 ];
break;
default:
//
// if we have more than one
//
var mostDerived = new TypeSystemForCodeTransformation.LinearHierarchyBuilder( lst, m_typeSystem ).Build();
if( mostDerived != null )
{
target = lst[ 0 ];
break;
}
throw TypeConsistencyErrorException.Create( "Found singleton factory that refers to a type with multiple concrete subclasses: {0}", target.FullName );
}
}
}
//--//
//
// Prepare method body
//
var bb = cfg.CreateFirstNormalBasicBlock();
md.BuildTimeFlags &= ~MethodRepresentation.BuildTimeAttributes.NoInline;
md.BuildTimeFlags |= MethodRepresentation.BuildTimeAttributes.Inline;
//
// Create proper flow control for exit basic block.
//
cfg.AddReturnOperator();
//--//
DataManager.Attributes attrib;
if(ca.HasNamedArg( "ReadOnly" ))
{
attrib = DataManager.Attributes.Constant;
}
else
{
attrib = DataManager.Attributes.Mutable;
}
attrib |= DataManager.Attributes.SuitableForConstantPropagation;
//--//
CustomAttributeRepresentation caMemoryMapped;
Expression ex;
Annotation an = null;
if(m_typeSystem.MemoryMappedPeripherals.TryGetValue( target, out caMemoryMapped ))
{
object baseObj = caMemoryMapped.GetNamedArg( "Base" );
if(baseObj == null)
{
throw TypeConsistencyErrorException.Create( "Found MemoryMappedPeripheral with singleton factory and no Base address: {0}", target.FullName );
}
uint baseAddress = (uint)baseObj;
ex = m_typeSystem.CreateConstant( target, baseAddress );
an = MemoryMappedPeripheralAnnotation.Create( m_typeSystem, caMemoryMapped );
}
else
{
ex = m_typeSystem.GenerateConstantForSingleton( target, attrib );
}
var opNew = SingleAssignmentOperator.New( null, dst, ex );
opNew.AddAnnotation( NotNullAnnotation.Create( m_typeSystem ) );
if(an != null)
{
opNew.AddAnnotation( an );
}
bb.AddOperator( opNew );
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/OptimizationsPhaseExecution.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#define OPTIMIZATION_REPORT_SLOW_METHODS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class OptimizationsPhaseExecution : SingleMethodPhaseExecution
{
class State
{
//
// State
//
private GrowOnlySet< OptimizationHandlerAttribute > m_dontExecute;
//--//
internal bool CanExecute( OptimizationHandlerAttribute ca )
{
if(m_dontExecute != null)
{
if(m_dontExecute.Contains( ca ))
{
return false;
}
}
return true;
}
internal void SetAsDontExecute( OptimizationHandlerAttribute ca )
{
if(m_dontExecute == null)
{
m_dontExecute = SetFactory.NewWithReferenceEquality< OptimizationHandlerAttribute >();
}
m_dontExecute.Insert( ca );
}
}
//
// State
//
private GrowOnlyHashTable< MethodRepresentation, State > m_methods;
private OptimizationHandlerAttribute[] m_order;
//
// Constructor Methods
//
public OptimizationsPhaseExecution( TypeSystemForCodeTransformation typeSystem ,
DelegationCache cache ,
CallsDataBase callsDatabase ,
PhaseDriver phase ) : base( typeSystem, cache, callsDatabase, phase )
{
m_methods = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, State >();
m_order = new OptimizationHandlerAttribute[0];
//--//
CompileOrder();
}
//
// Helper Methods
//
public override void Analyze( MethodRepresentation md )
{
ControlFlowGraphStateForCodeTransformation cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
State state;
if(m_methods.TryGetValue( md, out state ) == false)
{
state = new State();
m_methods[md] = state;
}
NotificationContext nc = new NotificationContext( this );
nc.CurrentMethod = md;
nc.CurrentCFG = cfg;
#if OPTIMIZATION_REPORT_SLOW_METHODS
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
int iterations = 0;
int iterations_SSA_In = 0;
int iterations_SSA_Out = 0;
int iterations_SSA_Undo = 0;
#endif
while(true)
{
#if OPTIMIZATION_REPORT_SLOW_METHODS
iterations++;
#endif
nc.StartScan();
foreach(OptimizationHandlerAttribute ca in m_order)
{
if(state.CanExecute( ca ))
{
if(ca.RunInExtendedSSAForm)
{
#if OPTIMIZATION_REPORT_SLOW_METHODS
iterations_SSA_In++;
#endif
Transformations.StaticSingleAssignmentForm.InsertPiOperators( cfg );
Transformations.StaticSingleAssignmentForm.ConvertInto( cfg );
}
else if(ca.RunInSSAForm)
{
#if OPTIMIZATION_REPORT_SLOW_METHODS
iterations_SSA_In++;
#endif
Transformations.StaticSingleAssignmentForm.RemovePiOperators( cfg );
Transformations.StaticSingleAssignmentForm.ConvertInto( cfg );
}
else if(ca.RunInNormalForm)
{
#if OPTIMIZATION_REPORT_SLOW_METHODS
iterations_SSA_Out++;
#endif
Transformations.StaticSingleAssignmentForm.ConvertOut( cfg, true );
}
Transformations.RemoveDeadCode.Execute( cfg, false );
NotificationOfTransformation dlg = m_delegationForOptimization[ca];
cfg.TraceToFile( "Optimization-Pre - " + dlg.Method );
dlg( nc );
cfg.TraceToFile( "Optimization-Post" );
if(Transformations.StaticSingleAssignmentForm.ShouldTransformInto( cfg ))
{
#if OPTIMIZATION_REPORT_SLOW_METHODS
iterations_SSA_Undo++;
#endif
//
// Since the graph is no longer in SSA form, it's best to properly convert it out.
//
Transformations.StaticSingleAssignmentForm.ConvertOut( cfg, true );
}
if(ca.RunOnce)
{
state.SetAsDontExecute( ca );
}
if(nc.CanContinue == false) break;
}
}
if(nc.CanContinue)
{
break;
}
}
#if OPTIMIZATION_REPORT_SLOW_METHODS
sw.Stop();
if(sw.ElapsedMilliseconds >= 1500)
{
Console.WriteLine( "NOTICE: Optimizations for method '{0}' took {1} milliseconds and {2} iterations! [{3} variables and {4} operators]", cfg.Method.ToShortString(), sw.ElapsedMilliseconds, iterations, cfg.DataFlow_SpanningTree_Variables.Length, cfg.DataFlow_SpanningTree_Operators.Length );
Console.WriteLine( "NOTICE: SSA In = {0}, SSA Out = {1}, SSA Undo = {2}", iterations_SSA_In, iterations_SSA_Out, iterations_SSA_Undo );
Console.WriteLine();
}
#endif
}
}
//--//
private void CompileOrder()
{
foreach(OptimizationHandlerAttribute ca in m_delegationForOptimization.Keys)
{
if(ca.RunBefore != null)
{
OptimizationHandlerAttribute ca2 = FindTarget( ca, ca.RunBefore );
if(ca2 == null)
{
throw TypeConsistencyErrorException.Create( "Cannot find optimization '{0}', needed for proper sequencing of {1}", ca.RunBefore, m_delegationForOptimization[ca].Method );
}
ca.caToRunAfterThis = ca2;
}
if(ca.RunAfter != null)
{
OptimizationHandlerAttribute ca2 = FindTarget( ca, ca.RunAfter );
if(ca2 == null)
{
throw TypeConsistencyErrorException.Create( "Cannot find optimization '{0}', needed for proper sequencing of {1}", ca.RunAfter, m_delegationForOptimization[ca].Method );
}
ca.caToRunBeforeThis = ca2;
}
}
foreach(OptimizationHandlerAttribute ca in m_delegationForOptimization.Keys)
{
if(ArrayUtility.FindReferenceInNotNullArray( m_order, ca ) < 0)
{
if(ca.caToRunBeforeThis != null)
{
if(ArrayUtility.FindReferenceInNotNullArray( m_order, ca.caToRunBeforeThis ) < 0)
{
m_order = ArrayUtility.AppendToNotNullArray( m_order, ca.caToRunBeforeThis );
}
}
if(ca.caToRunAfterThis != null)
{
int pos = ArrayUtility.FindReferenceInNotNullArray( m_order, ca.caToRunAfterThis );
if(pos >= 0)
{
m_order = ArrayUtility.InsertAtPositionOfNotNullArray( m_order, pos, ca );
continue;
}
}
m_order = ArrayUtility.AppendToNotNullArray( m_order, ca );
}
}
//
// Ensure we have the correct ordering.
//
for(int pos = 0; pos < m_order.Length; pos++)
{
OptimizationHandlerAttribute ca = m_order[pos];
if(ca.caToRunAfterThis != null && ArrayUtility.FindReferenceInNotNullArray( m_order, ca.caToRunAfterThis ) < pos)
{
throw TypeConsistencyErrorException.Create( "Cannot find scheduling to put {0} after {1}", m_delegationForOptimization[ca].Method, m_delegationForOptimization[ca.caToRunAfterThis].Method );
}
if(ca.caToRunBeforeThis != null && ArrayUtility.FindReferenceInNotNullArray( m_order, ca.caToRunBeforeThis ) > pos)
{
throw TypeConsistencyErrorException.Create( "Cannot find scheduling to put {0} before {1}", m_delegationForOptimization[ca].Method, m_delegationForOptimization[ca.caToRunBeforeThis].Method );
}
}
}
private OptimizationHandlerAttribute FindTarget( OptimizationHandlerAttribute caSource ,
string id )
{
int pos = id.IndexOf( '.' );
string nameType;
string nameMethod;
if(pos < 0)
{
nameType = m_delegationForOptimization[caSource].Method.DeclaringType.Name;
nameMethod = id;
}
else
{
nameType = id.Substring( 0, pos );
nameMethod = id.Substring( pos+1 );
}
foreach(OptimizationHandlerAttribute ca in m_delegationForOptimization.Keys)
{
if(ca != caSource)
{
NotificationOfTransformation dlg = m_delegationForOptimization[ca];
System.Reflection.MethodInfo mi = dlg.Method;
if(nameMethod == mi. Name &&
nameType == mi.DeclaringType.Name )
{
return ca;
}
}
}
return null;
}
//--//
//
// Access Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/ParallelTransformationsHandler.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#define USE_THREAD_POOL
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
using System.Threading;
public class ParallelTransformationsHandler : IDisposable
{
public delegate void NotificationCallback( Operation phase, MethodRepresentation md, ref object state );
public enum Operation
{
Initialize,
Execute,
Shutdown,
}
internal class Worker
{
//
// State
//
private ParallelTransformationsHandler m_owner;
private volatile MethodRepresentation m_md;
private List< Exception > m_errors;
private object m_state;
#if !USE_THREAD_POOL
private System.Threading.Thread m_thread;
#endif
private System.Threading.AutoResetEvent m_waitForRequest;
//
// Constructor Methods
//
internal Worker( ParallelTransformationsHandler owner )
{
m_owner = owner;
m_errors = new List< Exception >();
m_state = null;
#if !USE_THREAD_POOL
m_thread = new System.Threading.Thread( Execute );
#endif
m_waitForRequest = new System.Threading.AutoResetEvent( false );
//--//
#if USE_THREAD_POOL
ThreadPool.QueueUserWorkItem( Execute );
#else
m_thread.Priority = System.Threading.ThreadPriority.BelowNormal;
m_thread.IsBackground = true;
m_thread.Start();
#endif
}
//
// Helper Methods
//
internal void Post( MethodRepresentation md )
{
m_md = md;
m_waitForRequest.Set();
}
internal void Stop()
{
m_md = null;
m_waitForRequest.Set();
#if !USE_THREAD_POOL
m_thread.Join();
#endif
if(m_errors.Count > 0)
{
throw new Exception( "Delivering exception from worker thread", m_errors[0] );
}
}
//--//
private void Execute(object state)
{
lock(m_owner.m_availableWorkers)
{
Notify( Operation.Initialize, null );
}
while(true)
{
lock(m_owner.m_availableWorkers)
{
m_owner.m_availableWorkers.Enqueue( this );
}
m_owner.m_availableSemaphore.Release();
m_waitForRequest.WaitOne();
MethodRepresentation md = m_md;
if(md == null)
{
break;
}
try
{
using(ControlFlowGraphState.LockThreadToMethod( md ))
{
Notify( Operation.Execute, md );
if(m_owner.m_mdCallback != null)
{
m_owner.m_mdCallback( md );
}
if(m_owner.m_cfgCallback != null)
{
ControlFlowGraphStateForCodeTransformation cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
m_owner.m_cfgCallback( cfg );
}
}
}
}
catch(Exception ex)
{
m_errors.Add( ex );
}
}
lock(m_owner.m_availableWorkers)
{
Notify( Operation.Shutdown, null );
}
}
private void Notify( Operation phase ,
MethodRepresentation md )
{
if(m_owner.m_notificationCallback != null)
{
m_owner.m_notificationCallback( phase, md, ref m_state );
}
}
}
//
// State
//
static int s_maximumNumberOfProcessorsToUse = int.MaxValue;
//--//
MethodEnumerationCallback m_mdCallback;
ControlFlowGraphEnumerationCallback m_cfgCallback;
NotificationCallback m_notificationCallback;
int m_procs;
Worker[] m_workers;
System.Threading.Semaphore m_availableSemaphore;
Queue< Worker > m_availableWorkers;
//
// Constructor Methods
//
public ParallelTransformationsHandler( MethodEnumerationCallback callback ) : this( callback, null, null )
{
}
public ParallelTransformationsHandler( ControlFlowGraphEnumerationCallback callback ) : this( null, callback, null )
{
}
public ParallelTransformationsHandler( MethodEnumerationCallback mdCallback ,
ControlFlowGraphEnumerationCallback cfgCallback ,
NotificationCallback notificationCallback )
{
int procs = (int)BitVector.CountBits( (uint)(System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity.ToInt32()) ) + 1;
if(procs > s_maximumNumberOfProcessorsToUse) procs = s_maximumNumberOfProcessorsToUse;
if(procs < 1 ) procs = 1;
//--//
m_mdCallback = mdCallback;
m_cfgCallback = cfgCallback;
m_notificationCallback = notificationCallback;
m_procs = procs;
m_workers = new Worker[procs];
m_availableSemaphore = new System.Threading.Semaphore( 0, (int)procs );
m_availableWorkers = new Queue< Worker >();
for(int idx = 0; idx < procs; idx++)
{
m_workers[idx] = new Worker( this );
}
}
//
// Helper Methods
//
public void Queue( MethodRepresentation md )
{
CHECKS.ASSERT( md != null, "Expecting method argument" );
m_availableSemaphore.WaitOne();
Worker worker;
lock(m_availableWorkers)
{
worker = m_availableWorkers.Dequeue();
}
worker.Post( md );
}
public void Synchronize()
{
for(int idx = 0; idx < m_procs; idx++)
{
m_availableSemaphore.WaitOne();
}
m_availableSemaphore.Release( m_procs );
}
public void Shutdown()
{
for(int idx = 0; idx < m_procs; idx++)
{
m_availableSemaphore.WaitOne();
Worker worker;
lock(m_availableWorkers)
{
worker = m_availableWorkers.Dequeue();
}
worker.Stop();
}
}
//--//
void IDisposable.Dispose()
{
Shutdown();
}
//--//
public static void EnumerateMethods( TypeSystemForCodeTransformation typeSystem ,
NotificationCallback callback )
{
using(ParallelTransformationsHandler handler = new ParallelTransformationsHandler( null, null, callback ))
{
typeSystem.EnumerateMethods( handler.EnumerationCallback );
}
}
public static void EnumerateMethods( TypeSystemForCodeTransformation typeSystem ,
MethodEnumerationCallback callback )
{
using(ParallelTransformationsHandler handler = new ParallelTransformationsHandler( callback ))
{
typeSystem.EnumerateMethods( handler.EnumerationCallback );
}
}
public static void EnumerateFlowGraphs( TypeSystemForCodeTransformation typeSystem ,
ControlFlowGraphEnumerationCallback callback )
{
using(ParallelTransformationsHandler handler = new ParallelTransformationsHandler( callback ))
{
typeSystem.EnumerateMethods( handler.EnumerationCallback );
}
}
//--//
private void EnumerationCallback( MethodRepresentation md )
{
this.Queue( md );
}
//
// Access Methods
//
public static int MaximumNumberOfProcessorsToUse
{
get
{
return s_maximumNumberOfProcessorsToUse;
}
set
{
s_maximumNumberOfProcessorsToUse = value;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/PhaseDriver.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public abstract class PhaseDriver
{
public delegate void Notification( PhaseDriver host, TypeSystemForCodeTransformation typeSystem );
//
// State
//
internal LinkedListNode< PhaseDriver > m_node;
protected Controller m_context;
protected Notification m_delegationForPhase_Before;
protected Notification m_delegationForPhase_After;
//
// Constructor Methods
//
protected PhaseDriver( Controller context )
{
m_context = context;
}
public bool Disabled
{
get;
set;
}
//
// Helper Methods
//
public static int CompareOrder( PhaseDriver phase ,
Type type )
{
if(phase == null)
{
return -1;
}
var phaseTarget = phase.FindPhaseByType( type );
if(phaseTarget == null)
{
return 1;
}
return phase.PhaseIndex.CompareTo( phaseTarget.PhaseIndex );
}
public int ComparePositionTo() where T : PhaseDriver
{
PhaseDriver target = FindPhase();
return this.PhaseIndex.CompareTo( target.PhaseIndex );
}
public T FindPhase< T >() where T : PhaseDriver
{
return (T)FindPhaseByType( typeof(T) );
}
public PhaseDriver FindPhaseByType( Type type )
{
if(m_node != null)
{
foreach(var phase in m_node.List)
{
if(phase.GetType() == type)
{
return phase;
}
}
}
return null;
}
//--//
public void RegisterForNotification( Notification target ,
bool fFirst )
{
if(fFirst)
{
m_delegationForPhase_Before += target;
}
else
{
m_delegationForPhase_After += target;
}
}
//--//
public PhaseDriver Execute()
{
ControlFlowGraphStateForCodeTransformation.SetPhaseForTrace( this );
this.DelegationCache.HookNotifications( this.TypeSystem, this );
{
var dlg = m_delegationForPhase_Before;
if(dlg != null)
{
m_delegationForPhase_Before = null;
dlg( this, this.TypeSystem );
}
}
var res = Run();
{
var dlg = m_delegationForPhase_After;
if(dlg != null)
{
m_delegationForPhase_After = null;
dlg( this, this.TypeSystem );
}
}
return res;
}
public abstract PhaseDriver Run();
//--//
protected void ValidateAbstractionLevel( Operator.OperatorLevel maxLevel )
{
var phase = this;
while(phase != null)
{
var attrib = ReflectionHelper.GetAttribute< PhaseLimitAttribute >( phase, true );
if(attrib != null && attrib.Level < maxLevel)
{
// LT72: mask inconsistencies to cope with missign optimizations
// throw TypeConsistencyErrorException.Create("Found operator at level {0} when limit was {1}", maxLevel, attrib.Level);
// LT72: log instead of throwing exception
Console.WriteLine(String.Format("Found operator at level {0} when limit was {1}", maxLevel, attrib.Level));
Console.WriteLine();
}
phase = phase.PreviousPhase;
}
}
public virtual void ValidatePhaseMovement( PhaseDriver prevPhase ,
PhaseDriver nextPhase )
{
var attrib = ReflectionHelper.GetAttribute< PhaseOrderingAttribute >( this, true );
if(attrib != null)
{
if(attrib.IsPipelineBlock && prevPhase.PhaseIndex > this.PhaseIndex)
{
if(nextPhase.PhaseIndex < this.PhaseIndex)
{
throw TypeConsistencyErrorException.Create( "Detected attempt to move past a pipeline block: {0} < {1}", nextPhase.GetType().FullName, this.GetType().FullName );
}
}
}
}
internal Operator.OperatorLevel ValidateOperatorLevels( ControlFlowGraphStateForCodeTransformation cfg )
{
Operator.OperatorLevel limit = this.MaximumAllowedLevel;
Operator.OperatorLevel max = Operator.OperatorLevel.Lowest;
var ts = this.TypeSystem;
foreach(Operator op in cfg.DataFlow_SpanningTree_Operators)
{
Operator.OperatorLevel level = ts.GetLevel( op );
if(max < level)
{
max = level;
}
if(level > limit)
{
// LT72: mask inconsistencies to cope with missign optimizations
// throw TypeConsistencyErrorException.Create( "Found operator at level {0} when limit was {1}: {2}", level, limit, op );
// LT72: log instead of throwing exception
Console.WriteLine(String.Format("Found operator at level {0} when limit was {1}: {2}", level, limit, op));
Console.WriteLine();
}
}
return max;
}
//--//
protected void PerformSequentialExecutionOfPhase( bool fInline ,
bool fExcludeGenericEntities )
{
var rpe = new SingleMethodPhaseExecution( this.TypeSystem, this.DelegationCache, this.CallsDataBase, this );
if(fInline)
{
this.CallsDataBase.ResetCallSites();
}
this.TypeSystem.EnumerateMethods( delegate( MethodRepresentation md )
{
if(fExcludeGenericEntities)
{
if(md.IsOpenMethod || md.OwnerType.IsOpenType)
{
return;
}
}
rpe.Analyze( md );
} );
if(fInline)
{
while(true)
{
this.CallsDataBase.AnalyzeForInlining();
GrowOnlySet< ControlFlowGraphStateForCodeTransformation > touched = this.CallsDataBase.ExecuteInlining( this.TypeSystem );
if(touched.Count == 0)
{
break;
}
foreach(ControlFlowGraphStateForCodeTransformation cfg in touched)
{
rpe.Analyze( cfg.Method );
}
}
}
ValidateAbstractionLevel( rpe.MaxAbstractionLevelEncountered );
}
protected void PerformParallelExecutionOfPhase( bool fInline ,
bool fExcludeGenericEntities )
{
var maxLevel = Operator.OperatorLevel.Lowest;
if(fInline)
{
this.CallsDataBase.ResetCallSites();
}
ParallelTransformationsHandler.EnumerateMethods( this.TypeSystem, delegate( ParallelTransformationsHandler.Operation phase, MethodRepresentation md, ref object state )
{
var rpe = (SingleMethodPhaseExecution)state;
switch(phase)
{
case ParallelTransformationsHandler.Operation.Initialize:
state = new SingleMethodPhaseExecution( this.TypeSystem, this.DelegationCache, this.CallsDataBase, this );
break;
case ParallelTransformationsHandler.Operation.Execute:
if(fExcludeGenericEntities)
{
if(md.IsOpenMethod || md.OwnerType.IsOpenType)
{
break;
}
}
rpe.Analyze( md );
break;
case ParallelTransformationsHandler.Operation.Shutdown:
if(maxLevel < rpe.MaxAbstractionLevelEncountered)
{
maxLevel = rpe.MaxAbstractionLevelEncountered;
}
break;
}
} );
if(fInline)
{
while(true)
{
this.CallsDataBase.AnalyzeForInlining();
var touched = this.CallsDataBase.ExecuteInlining( this.TypeSystem );
if(touched.Count == 0)
{
break;
}
ParallelTransformationsHandler.EnumerateMethods( this.TypeSystem, delegate( ParallelTransformationsHandler.Operation phase, MethodRepresentation md, ref object state )
{
var rpe = (SingleMethodPhaseExecution)state;
switch(phase)
{
case ParallelTransformationsHandler.Operation.Initialize:
state = new SingleMethodPhaseExecution( this.TypeSystem, this.DelegationCache, this.CallsDataBase, this );
break;
case ParallelTransformationsHandler.Operation.Execute:
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null && touched.Contains( cfg ))
{
rpe.Analyze( md );
}
break;
case ParallelTransformationsHandler.Operation.Shutdown:
if(maxLevel < rpe.MaxAbstractionLevelEncountered)
{
maxLevel = rpe.MaxAbstractionLevelEncountered;
}
break;
}
} );
}
}
ValidateAbstractionLevel( maxLevel );
}
//
// Debug Methods
//
public override string ToString()
{
return this.GetType().Name;
}
//
// Access Methods
//
public int PhaseIndex
{
get
{
int index = 0;
for(var phase = this; phase.PreviousPhase != null; phase = phase.PreviousPhase)
{
index++;
}
return index;
}
}
public PhaseDriver PreviousPhase
{
get
{
if(m_node != null)
{
var prev = m_node.Previous;
if(prev != null)
{
return prev.Value;
}
}
return null;
}
}
public PhaseDriver NextPhase
{
get
{
if(m_node != null)
{
var next = m_node.Next;
if(next != null)
{
return next.Value;
}
}
return null;
}
}
public Type ExecuteBefore
{
get
{
var attrib = ReflectionHelper.GetAttribute< PhaseOrderingAttribute >( this, true );
return attrib != null ? attrib.ExecuteBefore : null;
}
}
public Type ExecuteAfter
{
get
{
var attrib = ReflectionHelper.GetAttribute< PhaseOrderingAttribute >( this, true );
return attrib != null ? attrib.ExecuteAfter : null;
}
}
protected TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_context.TypeSystem;
}
}
public CallsDataBase CallsDataBase
{
get
{
return m_context.CallsDatabase;
}
}
protected DelegationCache DelegationCache
{
get
{
return this.TypeSystem.GetEnvironmentService< DelegationCache >();
}
}
protected Operator.OperatorLevel MaximumAllowedLevel
{
get
{
var attrib = ReflectionHelper.GetAttribute< PhaseLimitAttribute >( this, true );
if(attrib != null)
{
return attrib.Level;
}
var prev = this.PreviousPhase;
if(prev != null)
{
return prev.MaximumAllowedLevel;
}
return Operator.OperatorLevel.Highest;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/PhaseExecution.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#define REPORT_SLOW_METHODS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public abstract class PhaseExecution
{
public delegate void NotificationOfTransformation ( NotificationContext nc );
public delegate void NotificationOfTransformationForAttribute( NotificationContext nc, CustomAttributeRepresentation ca );
//--//
public class NotificationContext
{
[Flags]
enum NotificationStatus
{
Active = 0x00000000,
Skip = 0x00000001, // Don't invoke any other delegate for this operator.
Stop = 0x00000002, // Don't invoke any delegates at all.
Modified = 0x00000004, // The CFG has been touched.
}
//
// State
//
private readonly PhaseExecution m_owner;
private NotificationStatus m_status;
public MethodRepresentation CurrentMethod;
public ControlFlowGraphStateForCodeTransformation CurrentCFG;
public Operator CurrentOperator;
public object Value;
//
// Constructor Methods
//
internal NotificationContext( PhaseExecution owner )
{
m_owner = owner;
}
//
// Helper methods
//
internal void StartScan()
{
m_status = NotificationStatus.Active;
}
internal void ClearSkip()
{
m_status &= ~NotificationStatus.Skip;
}
public void StopScan()
{
m_status = NotificationStatus.Stop;
}
public void MarkAsModified()
{
m_status |= NotificationStatus.Skip | NotificationStatus.Modified;
}
//--//
public void SetMaxAbstractionLevelEncountered( Operator.OperatorLevel level )
{
if(m_owner.m_maxAbstractionLevelEncountered < level)
{
m_owner.m_maxAbstractionLevelEncountered = level;
}
}
public CallOperator GetOperatorAndThrowIfNotCall()
{
CallOperator op = this.CurrentOperator as CallOperator;
if(op == null)
{
throw TypeConsistencyErrorException.Create( "'{0}' cannot be used with {1}, it's a restricted method", this.Value, this.CurrentOperator );
}
return op;
}
public TemporaryVariableExpression AllocateTemporary( TypeRepresentation td )
{
return this.CurrentCFG.AllocateTemporary( td, null );
}
//--//
public bool IsParameterConstant( CallOperator op ,
int index )
{
var ex = op.Arguments[index];
var exConst = ex as ConstantExpression;
return (exConst != null);
}
public uint ExtractConstantUIntParameter( CallOperator op ,
int index )
{
var ex = op.Arguments[index];
var exConst = ex as ConstantExpression;
if(exConst != null)
{
ulong val;
if(exConst.GetAsUnsignedInteger( out val ))
{
return (uint)val;
}
}
throw TypeConsistencyErrorException.Create( "Expecting integer constant for {0}-th parameter in call to {1}, got {2}", index + 1, op.TargetMethod.ToShortString(), ex );
}
public int ExtractConstantIntParameter( CallOperator op ,
int index )
{
var ex = op.Arguments[index];
var exConst = ex as ConstantExpression;
if(exConst != null)
{
long val;
if(exConst.GetAsSignedInteger( out val ))
{
return (int)val;
}
}
throw TypeConsistencyErrorException.Create( "Expecting integer constant for {0}-th parameter in call to {1}, got {2}", index + 1, op.TargetMethod.ToShortString(), ex );
}
public bool ExtractConstantBoolParameter( CallOperator op ,
int index )
{
var ex = op.Arguments[index];
var exConst = ex as ConstantExpression;
if(exConst != null)
{
ulong val;
if(exConst.GetAsUnsignedInteger( out val ))
{
return val != 0;
}
}
throw TypeConsistencyErrorException.Create( "Expecting boolean constant for {0}-th parameter in call to {1}, got {2}", index + 1, op.TargetMethod.ToShortString(), ex );
}
public PhysicalRegisterExpression GetVariableForRegisterEncoding( uint encoding )
{
return GetVariableForRegisterEncoding( this.TypeSystem.WellKnownTypes.System_UIntPtr, encoding );
}
public PhysicalRegisterExpression GetVariableForRegisterEncoding( TypeRepresentation td ,
uint encoding )
{
return this.CurrentCFG.AllocateTypedPhysicalRegister( td, this.TypeSystem.PlatformAbstraction.GetRegisterForEncoding( encoding ), null, null, 0 );
}
//--//
//
// Access methods
//
public TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_owner.m_typeSystem;
}
}
public PhaseDriver Phase
{
get
{
return m_owner.m_phase;
}
}
public bool CanContinue
{
get
{
return m_status == NotificationStatus.Active;
}
}
public bool ShouldSkip
{
get
{
return (m_status & NotificationStatus.Skip) != 0;
}
}
public bool ShouldStop
{
get
{
return (m_status & NotificationStatus.Stop) != 0;
}
}
public bool WasModified
{
get
{
return (m_status & NotificationStatus.Modified) != 0;
}
}
}
protected class NotificationIssuer
{
List< NotificationOfTransformation > m_list;
internal NotificationIssuer()
{
m_list = new List< NotificationOfTransformation >();
}
internal void Add( NotificationOfTransformation dlg )
{
if(m_list.Contains( dlg ) == false)
{
m_list.Add( dlg );
}
}
internal bool Invoke( NotificationContext nc )
{
if(nc.ShouldSkip) return false;
foreach(NotificationOfTransformation dlg in m_list)
{
if(nc.CurrentCFG != null)
{
nc.CurrentCFG.TraceToFile( dlg );
}
dlg( nc );
if(nc.ShouldSkip) return false;
if(nc.ShouldStop) return false;
}
return true;
}
}
//
// State
//
protected TypeSystemForCodeTransformation m_typeSystem;
protected DelegationCache m_cache;
protected CallsDataBase m_callsDatabase;
protected PhaseDriver m_phase;
protected Operator.OperatorLevel m_maxAbstractionLevelEncountered;
private NotificationIssuer m_delegationForFlowGraph_Before;
private NotificationIssuer m_delegationForFlowGraph_After;
private GrowOnlyHashTable< BaseRepresentation , NotificationIssuer > m_delegationForEntities;
private GrowOnlyHashTable< MethodRepresentation , NotificationIssuer > m_delegationForCallEntities;
private GrowOnlyHashTable< Type , NotificationIssuer > m_delegationForOperators;
private GrowOnlyHashTable< Type , NotificationIssuer > m_delegationForArguments;
protected GrowOnlyHashTable< OptimizationHandlerAttribute, NotificationOfTransformation > m_delegationForOptimization;
private GrowOnlySet < Operator > m_operatorNotificationHistory;
//
// Constructor Methods
//
public PhaseExecution( TypeSystemForCodeTransformation typeSystem ,
DelegationCache cache ,
CallsDataBase callsDatabase ,
PhaseDriver phase )
{
m_typeSystem = typeSystem;
m_cache = cache;
m_callsDatabase = callsDatabase;
m_phase = phase;
m_maxAbstractionLevelEncountered = Operator.OperatorLevel.Lowest;
m_delegationForFlowGraph_Before = new NotificationIssuer();
m_delegationForFlowGraph_After = new NotificationIssuer();
m_delegationForEntities = HashTableFactory.NewWithReferenceEquality< BaseRepresentation , NotificationIssuer >();
m_delegationForCallEntities = HashTableFactory.NewWithReferenceEquality< MethodRepresentation , NotificationIssuer >();
m_delegationForOperators = HashTableFactory.NewWithReferenceEquality< Type , NotificationIssuer >();
m_delegationForArguments = HashTableFactory.NewWithReferenceEquality< Type , NotificationIssuer >();
m_delegationForOptimization = HashTableFactory.NewWithReferenceEquality< OptimizationHandlerAttribute, NotificationOfTransformation >();
m_operatorNotificationHistory = SetFactory .NewWithReferenceEquality< Operator >();
//--//
cache.HookNotifications( typeSystem, this, phase );
}
//
// Helper Methods
//
protected void AnalyzeMethod( MethodRepresentation md )
{
NotificationContext nc = new NotificationContext( this );
nc.CurrentMethod = md;
nc.CurrentCFG = TypeSystemForCodeTransformation.GetCodeForMethod( md );
#if REPORT_SLOW_METHODS
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
int iterations = 0;
#endif
using(new PerformanceCounters.ContextualTiming( nc.CurrentCFG, "AnalyzeMethod" ))
{
while(true)
{
#if REPORT_SLOW_METHODS
iterations++;
#endif
if(BeginScan ( nc ) &&
ConvertMethod( nc ) &&
EndScan ( nc ) )
{
break;
}
}
}
#if REPORT_SLOW_METHODS
sw.Stop();
if(sw.ElapsedMilliseconds >= 1500)
{
int variablesCount = (nc.CurrentCFG != null ? nc.CurrentCFG.DataFlow_SpanningTree_Variables.Length : 0);
int operatorsCount = (nc.CurrentCFG != null ? nc.CurrentCFG.DataFlow_SpanningTree_Operators.Length : 0);
Console.WriteLine( "NOTICE: Processing for method '{0}' took {1} milliseconds and {2} iterations! [{3} variables and {4} operators]", nc.CurrentMethod.ToShortString(), sw.ElapsedMilliseconds, iterations, variablesCount, operatorsCount );
Console.WriteLine();
}
#endif
}
protected virtual bool BeginScan( NotificationContext nc )
{
m_operatorNotificationHistory.Clear();
nc.StartScan();
return m_delegationForFlowGraph_Before.Invoke( nc );
}
protected virtual bool ConvertMethod( NotificationContext nc )
{
if(nc.CurrentCFG == null)
{
//
// Nothing to do.
//
return true;
}
//
// Shortcut the processing of the method, in case we don't need to track too many details.
//
{
bool fGotEntities = (m_delegationForEntities .Count != 0 || m_delegationForCallEntities.Count != 0);
bool fGotOperators = (m_delegationForOperators.Count != 0);
bool fGotArguments = (m_delegationForArguments.Count != 0);
if(fGotEntities == false &&
fGotArguments == false )
{
if(fGotOperators)
{
foreach(Operator op in nc.CurrentCFG.DataFlow_SpanningTree_Operators)
{
nc.CurrentOperator = op;
nc.Value = op;
nc.ClearSkip();
if(m_operatorNotificationHistory.Insert( op ) == false)
{
InvokeByType( m_delegationForOperators, op, nc );
}
if(nc.ShouldStop) return false;
if(nc.ShouldSkip) continue;
CallOperator call = op as CallOperator;
if(call != null)
{
m_callsDatabase.RegisterCallSite( call );
}
}
if(nc.WasModified) return false;
}
return true;
}
}
bool fContinue = Transformations.ScanCodeWithCallback.Execute( m_typeSystem, this, nc.CurrentCFG, delegate( Operator op, object target )
{
nc.CurrentOperator = op;
nc.Value = target;
nc.ClearSkip();
while(true)
{
BaseRepresentation br = target as BaseRepresentation;
if(br != null)
{
NotificationIssuer ni;
if(m_delegationForEntities.TryGetValue( br, out ni ))
{
if(!ni.Invoke( nc )) break;
}
MethodRepresentation md = br as MethodRepresentation;
CallOperator opCall = op as CallOperator;
if(md != null && opCall != null && opCall.TargetMethod == md)
{
if(m_delegationForCallEntities.TryGetValue( md, out ni ))
{
if(!ni.Invoke( nc )) break;
}
}
}
if(target != null)
{
if(!InvokeByType( m_delegationForArguments, target, nc )) break;
}
if(op != null && m_operatorNotificationHistory.Insert( op ) == false)
{
if(!InvokeByType( m_delegationForOperators, op, nc )) break;
}
break;
}
if(nc.ShouldStop) return Transformations.ScanCodeWithCallback.CallbackResult.Stop;
if(nc.ShouldSkip) return Transformations.ScanCodeWithCallback.CallbackResult.SkipToNextOperator;
CallOperator call = target as CallOperator;
if(call != null)
{
m_callsDatabase.RegisterCallSite( call );
}
return Transformations.ScanCodeWithCallback.CallbackResult.Proceed;
} );
if(fContinue)
{
fContinue = (nc.WasModified == false);
}
return fContinue;
}
protected virtual bool EndScan( NotificationContext nc )
{
if(!m_delegationForFlowGraph_After.Invoke( nc ))
{
return false;
}
if(!nc.CanContinue)
{
return false;
}
ControlFlowGraphStateForCodeTransformation cfg = nc.CurrentCFG;
if(cfg != null)
{
nc.SetMaxAbstractionLevelEncountered( nc.Phase.ValidateOperatorLevels( cfg ) );
}
return true;
}
//--//
public void RegisterForNotificationOfOptimization( OptimizationHandlerAttribute ca ,
NotificationOfTransformation target )
{
m_delegationForOptimization[ca] = target;
}
public void RegisterForNotificationOfFlowGraph( NotificationOfTransformation target ,
bool fFirst )
{
if(fFirst)
{
m_delegationForFlowGraph_Before.Add( target );
}
else
{
m_delegationForFlowGraph_After.Add( target );
}
}
public void RegisterForNotificationOfOperatorsByType( Type cls ,
NotificationOfTransformation target )
{
RegisterForNotification( m_delegationForOperators, cls, target );
}
public void RegisterForNotificationOfOperatorByTypeOfArguments( Type cls ,
NotificationOfTransformation target )
{
RegisterForNotification( m_delegationForArguments, cls, target );
}
public void RegisterForNotificationOfOperatorByEntities( BaseRepresentation br ,
NotificationOfTransformation target )
{
if(br != null)
{
RegisterForNotification( m_delegationForEntities, br, target );
}
}
public void RegisterForNotificationOfCallOperatorByEntities( MethodRepresentation md ,
NotificationOfTransformation target )
{
if(md != null)
{
RegisterForNotification( m_delegationForCallEntities, md, target );
}
}
//--//
private void RegisterForNotification( GrowOnlyHashTable< T, NotificationIssuer > ht ,
T key ,
NotificationOfTransformation target ) where T : class
{
NotificationIssuer res;
if(ht.TryGetValue( key, out res ) == false)
{
res = new NotificationIssuer();
ht[key] = res;
}
res.Add( target );
}
//--//
private bool InvokeByType( GrowOnlyHashTable< Type, NotificationIssuer > ht ,
object target ,
NotificationContext nc )
{
Type type = target.GetType();
while(type != null)
{
NotificationIssuer ni;
if(ht.TryGetValue( type, out ni ))
{
if(!ni.Invoke( nc )) return false;
}
type = type.BaseType;
}
return true;
}
//--//
//
// Access Methods
//
public Operator.OperatorLevel MaxAbstractionLevelEncountered
{
get
{
return m_maxAbstractionLevelEncountered;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/PhaseDrivers/SingleMethodPhaseExecution.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public class SingleMethodPhaseExecution : PhaseExecution
{
//
// State
//
MethodRepresentation m_currentMethod;
//
// Constructor Methods
//
public SingleMethodPhaseExecution( TypeSystemForCodeTransformation typeSystem ,
DelegationCache cache ,
CallsDataBase callsDatabase ,
PhaseDriver phase ) : base( typeSystem, cache, callsDatabase, phase )
{
}
//
// Helper Methods
//
public virtual void Analyze( MethodRepresentation md )
{
m_currentMethod = md;
AnalyzeMethod( md );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/AllocateRegisters.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(CollectRegisterAllocationConstraints), IsPipelineBlock=true )]
[PhaseLimit( Operator.OperatorLevel.StackLocations )]
public sealed class AllocateRegisters : PhaseDriver
{
//
// Constructor Methods
//
public AllocateRegisters( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
//// GrowOnlySet< Type > set = SetFactory.New< Type >();
ParallelTransformationsHandler.EnumerateFlowGraphs( this.TypeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
Transformations.GlobalRegisterAllocation.Execute( cfg );
cfg.DropDeadVariables();
//// lock(set)
//// {
//// foreach(IR.Operator op in cfg.SpanningTreeOperators)
//// {
//// set.Insert( op.GetType() );
//// }
//// }
} );
//// foreach(Type t in set)
//// {
//// Console.WriteLine( "{0}", t.FullName );
//// }
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ApplyClassExtensions.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(TransformFinallyBlocksIntoTryBlocks) )]
public sealed class ApplyClassExtensions : PhaseDriver
{
//
// Constructor Methods
//
public ApplyClassExtensions( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
var ace = new CompilationSteps.ApplyClassExtensions( this.TypeSystem );
ace.Run();
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ApplyConfigurationSettings.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(CrossReferenceTypeSystem) )]
public sealed class ApplyConfigurationSettings : PhaseDriver
{
//
// Constructor Methods
//
public ApplyConfigurationSettings( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, false );
this.CallsDataBase.ExecuteInlining( this.TypeSystem );
ApplyGarbageCollectorConfiguration();
return this.NextPhase;
}
private void ApplyGarbageCollectorConfiguration()
{
var wkt = TypeSystem.WellKnownTypes;
var gcImpls = TypeSystem.CollectConcreteImplementations(wkt.Microsoft_Zelig_Runtime_GarbageCollectionManager);
CHECKS.ASSERT(gcImpls.Count == 1, "There can only be 1 active garbage collection manager");
var gcImpl = gcImpls[0];
Console.WriteLine("Garbage collector selected: {0}", gcImpl.FullName);
// Since ReferenceCountingCollector is done by code injection during compile time
// (and the ReferenceCountingCollector class itself is only a dummy class with
// empty implementations), we need to detect its selection here and enable the
// code path for code injection here for the later phases.
if (gcImpl.IsSubClassOf(wkt.Microsoft_Zelig_Runtime_ReferenceCountingCollector, null))
{
TypeSystem.ReferenceCountingGarbageCollectionStatus = TypeSystemForCodeTransformation.ReferenceCountingStatus.Enabled;
}
else if (gcImpl.IsSubClassOf(wkt.Microsoft_Zelig_Runtime_StrictReferenceCountingCollector, null))
{
TypeSystem.ReferenceCountingGarbageCollectionStatus = TypeSystemForCodeTransformation.ReferenceCountingStatus.EnabledStrict;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/CollectRegisterAllocationConstraints.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(PrepareForRegisterAllocation) )]
public sealed class CollectRegisterAllocationConstraints : PhaseDriver
{
//
// Constructor Methods
//
public CollectRegisterAllocationConstraints( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/CompleteImplementationOfInternalMethods.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(EstimateTypeSystemReduction) )]
public sealed class CompleteImplementationOfInternalMethods : PhaseDriver
{
//
// Constructor Methods
//
public CompleteImplementationOfInternalMethods( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
var phaseStart = FindPhase< PrepareImplementationOfInternalMethods >();
if(phaseStart.m_state.Complete() == false)
{
this.TypeSystem.BuildCrossReference();
return FindPhase< HighLevelTransformations >();
}
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ComputeCallsClosure.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define DEBUG_INCLUDE_ALL_METHODS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter = typeof( PropagateCompilationConstraints ) )]
public sealed class ComputeCallsClosure : PhaseDriver
{
//
// State
//
private CompilationSteps.ComputeCallsClosure m_state;
//
// Constructor Methods
//
public ComputeCallsClosure( Controller context )
: base( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run( )
{
this.CallsDataBase.ResetCallSites( );
m_state = new CompilationSteps.ComputeCallsClosure( this.TypeSystem, this.DelegationCache, this.CallsDataBase, this, false );
if( this.TypeSystem.PlatformAbstraction.CodeGenerator == TargetModel.ArmProcessor.InstructionSetVersion.CodeGenerator_LLVM )
{
//MethodRepresentation mainThread = null;
//this.TypeSystem.EnumerateMethods( delegate( MethodRepresentation md )
//{
// if( md.Name.Equals( "MainThread" ) && md.OwnerType.Equals( this.TypeSystem.WellKnownMethods ) )
// {
// mainThread = md;
// }
//} );
//if( mainThread != null)
//{
// m_state.Execute( mainThread );
//}
//else
//{
// CHECKS.ASSERT( false, "No Thread Manager or no MainThread method found!!" );
//}
m_state.Execute( this.TypeSystem.GetWellKnownMethod( "Bootstrap_Initialization" ) );
}
else
{
#if DEBUG_INCLUDE_ALL_METHODS
this.TypeSystem.EnumerateMethods( delegate( MethodRepresentation md )
{
m_state.Execute( md );
} );
#else
m_state.Execute( this.TypeSystem.GetHandler( Runtime.HardwareException.Reset ) );
#endif
}
if (this.TypeSystem.IsReferenceCountingGarbageCollectionEnabled)
{
// Keep the reference counting methods around so they stay alive when we inject
// auto reference counting code in the ReferenceCountingGarbageCollection phase
var wkm = this.TypeSystem.WellKnownMethods;
m_state.Execute( wkm.ObjectHeader_AddReference );
m_state.Execute( wkm.ObjectHeader_ReleaseReference );
m_state.Execute( wkm.ThreadImpl_AllocateReleaseReferenceHelper );
m_state.Execute( wkm.ReferenceCountingCollector_Swap );
m_state.Execute( wkm.ReferenceCountingCollector_LoadAndAddReference );
m_state.Execute( wkm.ReferenceCountingCollector_ReferenceCountingExchange );
m_state.Execute( wkm.ReferenceCountingCollector_ReferenceCountingCompareExchange );
m_state.Execute( wkm.StringImpl_FastAllocateReferenceCountingString );
m_state.Execute( wkm.Bootstrap_ReferenceCountingInitialization );
m_state.Execute( wkm.ThreadManager_CleanupBootstrapThread );
}
this.TypeSystem.ExpandCallsClosure( m_state );
var touched = this.CallsDataBase.ExecuteInlining( this.TypeSystem );
if( touched.Count > 0 )
{
return this;
}
return this.NextPhase;
}
//
// Access Methods
//
public GrowOnlyHashTable> EntitiesReferencedByMethods
{
get
{
return m_state.EntitiesReferencedByMethods;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ConvertToSSA.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(Optimizations) )]
public sealed class ConvertToSSA : PhaseDriver
{
//
// Constructor Methods
//
public ConvertToSSA( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ConvertUnsupportedOperatorsToMethodCalls.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(MidLevelToLowLevelConversion) )]
public sealed class ConvertUnsupportedOperatorsToMethodCalls : PhaseDriver
{
//
// Constructor Methods
//
public ConvertUnsupportedOperatorsToMethodCalls( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( true, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/CrossReferenceTypeSystem.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(PrepareImplementationOfInternalMethods) )]
public sealed class CrossReferenceTypeSystem : PhaseDriver
{
//
// Constructor Methods
//
public CrossReferenceTypeSystem( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
this.TypeSystem.BuildCrossReference();
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/DetectNonImplementedInternalCalls.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define DEBUG_MISSING_METHODS_CALLERS
//#define STOP_ON_POSITIVE_DETECTION
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(ReduceTypeSystem) )]
public sealed class DetectNonImplementedInternalCalls : PhaseDriver
{
//
// Constructor Methods
//
public DetectNonImplementedInternalCalls( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
#if DEBUG_MISSING_METHODS_CALLERS
var missingMethods = new List< MethodRepresentation >();
foreach(TypeRepresentation td in this.TypeSystem.Types)
{
if(td.IsOpenType == false)
{
foreach(MethodRepresentation md in td.Methods)
{
if((md.Flags & MethodRepresentation.Attributes.Abstract) != 0) continue;
if(md.IsOpenMethod == false && TypeSystemForCodeTransformation.GetCodeForMethod( md ) == null)
{
missingMethods.Add( md );
}
}
}
}
#endif
#if STOP_ON_POSITIVE_DETECTION
if(missingMethods.Count > 0)
{
DumpMissingMethods( missingMethods );
throw TypeConsistencyErrorException.Create( "ERROR: found methods without an implementation" );
}
#endif
return this.NextPhase;
}
private void DumpMissingMethods( List< MethodRepresentation > lst )
{
var reverseIndex = new Transformations.ReverseIndexTypeSystem( this.TypeSystem );
reverseIndex.ProcessTypeSystem();
foreach(MethodRepresentation md in lst)
{
Console.WriteLine( "WARNING: missing implementation for {0}", md.ToShortString() );
#if DEBUG_MISSING_METHODS_CALLERS
var set = SetFactory.New< MethodRepresentation >();
DumpCallers( reverseIndex, set, md, 0, 2 );
#endif
Console.WriteLine();
}
}
private static void DumpCallers( Transformations.ReverseIndexTypeSystem reverseIndex ,
GrowOnlySet< MethodRepresentation > history ,
MethodRepresentation md ,
int depth ,
int maxDepth )
{
if(history.Insert( md ) == true)
{
return;
}
GrowOnlySet< MethodRepresentation > set = GetCallers( reverseIndex, md );
foreach(MethodRepresentation caller in set)
{
if(history.Contains( caller ) == false)
{
Console.WriteLine( " {0}called from {1}", new string( ' ', depth * 3 ), caller.ToShortString() );
if(depth < maxDepth)
{
DumpCallers( reverseIndex, history, caller, depth + 1, maxDepth );
}
}
}
}
private static GrowOnlySet< MethodRepresentation > GetCallers( Transformations.ReverseIndexTypeSystem reverseIndex ,
MethodRepresentation md )
{
GrowOnlySet< MethodRepresentation > res = SetFactory.NewWithReferenceEquality< MethodRepresentation >();
GrowOnlySet< object > set = reverseIndex[md];
if(set != null)
{
foreach(object obj in set)
{
CallOperator op = obj as CallOperator;
if(op != null && op.TargetMethod == md)
{
MethodRepresentation caller = op.BasicBlock.Owner.Method;
res.Insert( caller );
}
}
}
if(md is VirtualMethodRepresentation && md.VTableLayoutFlags == MethodRepresentation.Attributes.ReuseSlot)
{
TypeRepresentation td = md.OwnerType;
string name = md.Name;
while((td = td.Extends) != null)
{
foreach(MethodRepresentation md2 in td.Methods)
{
if(td.GetDeclarationOfMethodImpl( md2 ) != null)
{
continue; // Skip any method with an explicit MethodImpl.
}
if(md2.MatchNameAndSignature( name, md, null ))
{
res.Merge( GetCallers( reverseIndex, md2 ) );
break;
}
}
}
}
return res;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/Done.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(GenerateImage) )]
public sealed class Done : PhaseDriver
{
//
// Constructor Methods
//
public Done( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/EstimateTypeSystemReduction.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(ComputeCallsClosure))]
public sealed class EstimateTypeSystemReduction : PhaseDriver
{
//
// Constructor Methods
//
public EstimateTypeSystemReduction( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
this.TypeSystem.EstimateReduction();
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ExpandAggregateTypes.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(ConvertUnsupportedOperatorsToMethodCalls), IsPipelineBlock=true )]
[PhaseLimit( Operator.OperatorLevel.ScalarValues )]
public sealed class ExpandAggregateTypes : PhaseDriver
{
//
// Constructor Methods
//
public ExpandAggregateTypes( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/FromImplicitToExplicitExceptions.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This macro enables transformation from exception blocks to landing pad form.
#define ENABLE_LANDING_PADS
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter = typeof( HighLevelToMidLevelConversion ) )]
public sealed class FromImplicitToExplicitExceptions : PhaseDriver
{
//
// Constructor Methods
//
public FromImplicitToExplicitExceptions( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
#if ENABLE_LANDING_PADS
ParallelTransformationsHandler.EnumerateFlowGraphs(
this.TypeSystem,
delegate (ControlFlowGraphStateForCodeTransformation cfg)
{
Transformations.ConvertToLandingPads.Execute(cfg);
});
#endif // ENABLE_LANDING_PADS
PerformParallelExecutionOfPhase( true, false );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/FuseOperators.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(SplitComplexOperators) )]
public sealed class FuseOperators : PhaseDriver
{
//
// Constructor Methods
//
public FuseOperators( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/GenerateImage.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Enable this macro to run LLVM-specific transforms prior to generating the image.
#define LLVM
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(AllocateRegisters) )]
public sealed class GenerateImage : PhaseDriver
{
//
// Constructor Methods
//
public GenerateImage( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
#if LLVM
ParallelTransformationsHandler.EnumerateFlowGraphs(
this.TypeSystem,
delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
Transformations.MergeExtendedBasicBlocks.Execute( cfg, preserveInjectionSites: false );
} );
#endif // LLVM
this.TypeSystem.GenerateImage( this );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/HighLevelToMidLevelConversion.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter = typeof( LayoutTypes ) )]
public sealed class HighLevelToMidLevelConversion : PhaseDriver
{
//
// Constructor Methods
//
public HighLevelToMidLevelConversion( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( true, false );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/HighLevelTransformations.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter = typeof(ApplyConfigurationSettings))]
public sealed class HighLevelTransformations : PhaseDriver
{
//
// Constructor Methods
//
public HighLevelTransformations( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, false );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/LayoutTypes.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter = typeof( OrderStaticConstructors ), IsPipelineBlock = true )]
[PhaseLimit( Operator.OperatorLevel.ConcreteTypes )]
public sealed class LayoutTypes : PhaseDriver
{
//
// Constructor Methods
//
public LayoutTypes( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
this.TypeSystem.LayoutTypes( this.TypeSystem.PlatformAbstraction.MemoryAlignment );
this.TypeSystem.DataManagerInstance.RefreshValues( this );
this.TypeSystem.FlattenCallsDatabase( this.CallsDataBase.Analyze( this.TypeSystem ), fCallsTo: true );
this.TypeSystem.FlattenCallsDatabase( this.CallsDataBase.Analyze( this.TypeSystem ), fCallsTo: false );
return this.NextPhase;
}
public override void ValidatePhaseMovement( PhaseDriver prevPhase ,
PhaseDriver nextPhase )
{
base.ValidatePhaseMovement( prevPhase, nextPhase );
if(nextPhase.PhaseIndex < this.PhaseIndex)
{
this.TypeSystem.InvalidateLayout();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/MidLevelToLowLevelConversion.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof( ReferenceCountingGarbageCollection ) )]
[PhaseLimit( Operator.OperatorLevel.ConcreteTypes_NoExceptions )]
public sealed class MidLevelToLowLevelConversion : PhaseDriver
{
//
// Constructor Methods
//
public MidLevelToLowLevelConversion( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( true, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/Optimizations.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(FuseOperators) )]
public sealed class Optimizations : PhaseDriver
{
//
// Constructor Methods
//
public Optimizations( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
var maxLevel = Operator.OperatorLevel.Lowest;
ParallelTransformationsHandler.EnumerateMethods( this.TypeSystem, delegate( ParallelTransformationsHandler.Operation phase, MethodRepresentation md, ref object state )
{
var rpe = (OptimizationsPhaseExecution)state;
switch(phase)
{
case ParallelTransformationsHandler.Operation.Initialize:
state = new OptimizationsPhaseExecution( this.TypeSystem, this.DelegationCache, this.CallsDataBase, this );
break;
case ParallelTransformationsHandler.Operation.Execute:
if(md.IsOpenMethod == false && md.OwnerType.IsOpenType == false)
{
rpe.Analyze( md );
}
break;
case ParallelTransformationsHandler.Operation.Shutdown:
if(maxLevel < rpe.MaxAbstractionLevelEncountered)
{
maxLevel = rpe.MaxAbstractionLevelEncountered;
}
break;
}
} );
ValidateAbstractionLevel( maxLevel );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/OrderStaticConstructors.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter = typeof( DetectNonImplementedInternalCalls ) )]
public sealed class OrderStaticConstructors : PhaseDriver
{
//
// Constructor Methods
//
public OrderStaticConstructors( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
var mdTarget = this.TypeSystem.WellKnownMethods.TypeSystemManager_InvokeStaticConstructors;
if(mdTarget != null)
{
//
// 1) Build the call graph for the whole system.
//
var callGraph = new CallGraph( this.TypeSystem );
//
// 2) Walk through the methods that use field that require static constructors, collecting the cctors.
//
var constructors = HashTableFactory.NewWithReferenceEquality< MethodRepresentation, GrowOnlySet< MethodRepresentation > >();
foreach(var lst in callGraph.MethodsThatRequireStaticConstructors.Values)
{
foreach(var md in lst)
{
if(constructors.ContainsKey( md ) == false)
{
//
// 3) Create the call closure for each cctor, stopping at other static cctors.
//
GrowOnlySet< MethodRepresentation > setClosure = callGraph.ComputeClosure( md, FilterClosure );
//
// 4) Build a map from each static constructor to all the ones it depends on.
//
GrowOnlySet< MethodRepresentation > set = SetFactory.NewWithReferenceEquality< MethodRepresentation >();;
foreach(MethodRepresentation mdInClosure in setClosure)
{
if(mdInClosure != md)
{
if(mdInClosure is StaticConstructorMethodRepresentation)
{
set.Insert( mdInClosure );
}
}
}
constructors[md] = set;
}
}
}
//
// 5) Create an ordered list of static constructors to invoke, breaking loops if needed.
//
var invocationOrder = new List< MethodRepresentation >();
var processed = SetFactory.NewWithReferenceEquality< MethodRepresentation >();
//
// 6) Iterate until all the static constructors have been ordered.
//
while(processed.Count < constructors.Count)
{
bool fStuckInLoop = true;
foreach(var md in constructors.Keys)
{
if(processed.Contains( md ) == false)
{
bool fAdd = true;
foreach(var mdDepends in constructors[md])
{
if(processed.Contains( mdDepends ) == false)
{
fAdd = false;
break;
}
}
if(fAdd)
{
invocationOrder.Add ( md );
processed .Insert( md );
fStuckInLoop = false;
}
}
}
if(fStuckInLoop)
{
//
// Just pick one to break the loop.
//
MethodRepresentation mdBest = null;
Console.WriteLine( "WARNING: Detected loop between static constructors:" );
foreach(var md in constructors.Keys)
{
if(processed.Contains( md ) == false)
{
Console.WriteLine( " {0}", md.OwnerType.FullNameWithAbbreviation );
if(mdBest == null)
{
mdBest = md;
}
else if(constructors[md].Count < constructors[mdBest].Count)
{
mdBest = md;
}
}
}
CHECKS.ASSERT( mdBest != null, "Cannot be stuck in loop between static constructors when no items in the loop" );
invocationOrder.Add ( mdBest );
processed .Insert( mdBest );
}
}
//
// 7) Inject calls to static constructors into target method.
//
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( mdTarget );
var bb = cfg.NormalizedEntryBasicBlock;
foreach(var md in invocationOrder)
{
var rhs = this.TypeSystem.AddTypePointerToArgumentsOfStaticMethod( md );
var call = StaticCallOperator.New( null, CallOperator.CallKind.Direct, md, rhs );
bb.AddOperator( call );
}
}
return this.NextPhase;
}
private bool FilterClosure( MethodRepresentation mdNext )
{
if(mdNext is StaticConstructorMethodRepresentation)
{
return false;
}
var wkm = this.TypeSystem.WellKnownMethods;
if(SameMethodOrOverride( mdNext, wkm.TypeSystemManager_AllocateObject ) ||
SameMethodOrOverride( mdNext, wkm.TypeSystemManager_AllocateArray ) ||
SameMethodOrOverride( mdNext, wkm.TypeSystemManager_AllocateArrayNoClear ) ||
SameMethodOrOverride( mdNext, wkm.TypeSystemManager_AllocateString ) )
{
//
// These methods are already working by the time we get to class constructors, so let's stop the closure here.
//
return false;
}
if (SameMethodOrOverride(mdNext, wkm.TypeSystemManager_Throw) ||
SameMethodOrOverride(mdNext, wkm.TypeSystemManager_Rethrow))
{
//
// If a class constructor throws an exception, bad things are going to happen, so no need to expand the closure any further.
//
return false;
}
return true;
}
private static bool SameMethodOrOverride( MethodRepresentation md ,
MethodRepresentation mdTarget )
{
if(md == mdTarget)
{
return true;
}
if(md is VirtualMethodRepresentation &&
mdTarget is VirtualMethodRepresentation )
{
if(md.OwnerType.IsSubClassOf( mdTarget.OwnerType, null ))
{
int index = md .FindVirtualTableIndex();
int indexTarget = mdTarget.FindVirtualTableIndex();
if(index == indexTarget)
{
return true;
}
}
}
return false;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/PrepareExternalMethods.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter = typeof(ReduceTypeSystem), ExecuteBefore = typeof( DetectNonImplementedInternalCalls ) )]
public sealed class PrepareExternalMethods : PhaseDriver
{
//
// State
//
internal ImplementExternalMethods m_state;
//
// Constructor Methods
//
public PrepareExternalMethods( Controller context )
: base( context )
{
ExternalCallOperator.NativeImportDirectories = context.TypeSystem.NativeImportDirectories;
ExternalCallOperator.NativeImportLibraries = context.TypeSystem.NativeImportLibraries;
m_state = new ImplementExternalMethods( this.TypeSystem );
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
//this.TypeSystem.BuildCrossReference();
m_state.Prepare();
//DetectFieldInvariants.Execute( this.TypeSystem );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/PrepareForRegisterAllocation.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(ConvertToSSA) )]
public sealed class PrepareForRegisterAllocation : PhaseDriver
{
//
// Constructor Methods
//
public PrepareForRegisterAllocation( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/PrepareImplementationOfInternalMethods.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(ApplyClassExtensions) )]
public sealed class PrepareImplementationOfInternalMethods : PhaseDriver
{
//
// State
//
internal ImplementInternalMethods m_state;
//
// Constructor Methods
//
public PrepareImplementationOfInternalMethods( Controller context ) : base ( context )
{
m_state = new ImplementInternalMethods( this.TypeSystem );
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
this.TypeSystem.BuildCrossReference();
m_state.Prepare();
DetectFieldInvariants.Execute( this.TypeSystem );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/PropagateCompilationConstraints.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(HighLevelTransformations) )]
public sealed class PropagateCompilationConstraints : PhaseDriver
{
//
// Constructor Methods
//
public PropagateCompilationConstraints( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
var callsToInline = new Queue< CallOperator >();
ParallelTransformationsHandler.EnumerateFlowGraphs( this.TypeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
if(cfg.Method.IsOpenMethod == false)
{
EnforceCompilationConstraints( callsToInline, cfg );
}
} );
while(callsToInline.Count > 0)
{
CallOperator op = callsToInline.Dequeue();
var cfg = (ControlFlowGraphStateForCodeTransformation)op.BasicBlock.Owner;
cfg.TraceToFile( "InlineCall" );
var fSuccess = Transformations.InlineCall.Execute( op, null );
cfg.TraceToFile( "InlineCall-Post" );
if(fSuccess)
{
EnforceCompilationConstraints( callsToInline, cfg );
}
else
{
//
// Inling can fail if the target method doesn't have an implementation.
// For now, just proceed, it will be caught at a later stage.
//
//CHECKS.ASSERT( false, "Unexpected failure to force inlining" );
}
}
return this.NextPhase;
}
private static void EnforceCompilationConstraints( Queue< CallOperator > callsToInline ,
ControlFlowGraphStateForCodeTransformation cfg )
{
var toBeInlined = new List< CallOperator >();
cfg.EnforceCompilationConstraints( toBeInlined );
if(toBeInlined.Count > 0)
{
lock(callsToInline)
{
foreach(CallOperator op in toBeInlined)
{
callsToInline.Enqueue( op );
}
}
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ReduceNumberOfTemporaries.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public sealed class ReduceNumberOfTemporaries : PhaseDriver
{
//
// Constructor Methods
//
public ReduceNumberOfTemporaries( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
ParallelTransformationsHandler.EnumerateFlowGraphs( this.TypeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
Transformations.ReduceNumberOfTemporaries.Execute( cfg );
} );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ReduceTypeSystem.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(CompleteImplementationOfInternalMethods), IsPipelineBlock=true )]
[PhaseLimit( Operator.OperatorLevel.ObjectOriented )]
public sealed class ReduceTypeSystem : PhaseDriver
{
private TypeSystem m_typeSystem;
//
// Constructor Methods
//
public ReduceTypeSystem( Controller context ) : base ( context )
{
m_typeSystem = context.TypeSystem;
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
//
// Flush the call graph, because it could contain reduced methods.
//
this.CallsDataBase.ClearCallSites();
this.TypeSystem.PerformReduction();
this.TypeSystem.BuildCrossReference();
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ReferenceCountingGarbageCollection.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
using Microsoft.Zelig.Runtime.TypeSystem;
using System;
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
[PhaseOrdering( ExecuteAfter = typeof( FromImplicitToExplicitExceptions ) )]
public sealed class ReferenceCountingGarbageCollection : PhaseDriver
{
private GrowOnlySet m_modifiedOperators;
private GrowOnlyHashTable m_stats;
//
// Constructor Methods
//
public ReferenceCountingGarbageCollection( Controller context ) : base( context )
{
m_modifiedOperators = SetFactory.New( );
m_stats = HashTableFactory.New( );
}
public bool IsOperatorModified( Operator op )
{
lock (m_modifiedOperators)
{
return m_modifiedOperators.Contains( op );
}
}
public void AddToModifiedOperator( Operator op )
{
lock (m_modifiedOperators)
{
m_modifiedOperators.Insert( op );
}
}
public void IncrementInjectionCount( MethodRepresentation md )
{
lock (m_stats)
{
if(m_stats.ContainsKey( md ))
{
m_stats.Update( md, m_stats.GetValue( md ) + 1 );
}
else
{
m_stats.Add( md, 1 );
}
}
}
public void DecrementInjectionCount( MethodRepresentation md )
{
lock (m_stats)
{
CHECKS.ASSERT( m_stats.ContainsKey( md ), "DecrementInjectionCount error" );
m_stats.Update( md, m_stats.GetValue( md ) - 1 );
}
}
//
// Helper Methods
//
public override PhaseDriver Run( )
{
if(this.TypeSystem.IsReferenceCountingGarbageCollectionEnabled)
{
// 1. Inject reference counting specific setup / helpers
InjectReferenceCountingHelpers( );
// 2. Inject calls to AddReference and ReleaseReference for operators that copy references
// 3. Inject calls to ReleaseReference at the end of each function to for each local / temp variables.
PerformParallelExecutionOfPhase( true, false );
// 4. Reduce number of temporaries again to clean up the injected code
ParallelTransformationsHandler.EnumerateFlowGraphs( this.TypeSystem, delegate ( ControlFlowGraphStateForCodeTransformation cfg )
{
Transformations.ReduceNumberOfTemporaries.Execute( cfg );
} );
// 5: Dump out the counts of each injection for informational purpose
DumpInjectionStats( );
}
return this.NextPhase;
}
private void DumpInjectionStats()
{
Console.WriteLine( );
Console.WriteLine( " Reference Counting GC Code Injection Stats" );
Console.WriteLine( " ================================================" );
int total = 0;
foreach(var md in m_stats.Keys)
{
var count = m_stats.GetValue( md );
Console.WriteLine( " {0,-20} :{1, 6}", md.Name, count );
total += count;
}
Console.WriteLine( " ------------------------------------------------" );
Console.WriteLine( " {0,-20} :{1, 6}", "Total", total );
Console.WriteLine( " ================================================" );
Console.WriteLine( );
}
private struct Injection
{
public String method;
public Func arguments;
public String target;
public BasicBlock.Qualifier injectionPoint;
}
private void InjectReferenceCountingHelpers( )
{
Injection[] injections = new Injection[] {
new Injection {
method = "ThreadImpl_AllocateReleaseReferenceHelper",
arguments = cfg => new Expression[] { cfg.Arguments[ 0 ] },
target = "ThreadImpl_ctor",
injectionPoint = BasicBlock.Qualifier.EntryInjectionStart
},
new Injection {
method = "Bootstrap_ReferenceCountingInitialization",
arguments = cfg => Expression.SharedEmptyArray,
target = "Bootstrap_HeapInitialization",
injectionPoint = BasicBlock.Qualifier.ExitInjectionStart
},
new Injection {
method = "ThreadManager_CleanupBootstrapThread",
arguments = cfg => Expression.SharedEmptyArray,
target = "ThreadManager_CleanupBootstrapThreadIfNeeded",
injectionPoint = BasicBlock.Qualifier.EntryInjectionStart
},
};
var ts = this.TypeSystem;
foreach (var injection in injections)
{
var target = ts.GetWellKnownMethod( injection.target );
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( target );
var injectionPoint = cfg.GetInjectionPoint( injection.injectionPoint );
var method = ts.GetWellKnownMethod( injection.method );
var arguments = injection.arguments( cfg );
Operator call;
if (method is StaticMethodRepresentation)
{
var rhs = ts.AddTypePointerToArgumentsOfStaticMethod( method, arguments );
call = StaticCallOperator.New( null, CallOperator.CallKind.Direct, method, rhs );
}
else
{
call = InstanceCallOperator.New( null, CallOperator.CallKind.Direct, method, arguments, false );
}
injectionPoint.AddOperator( call );
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/ResourceManagerOptimizations.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(ApplyConfigurationSettings), ExecuteBefore=typeof(HighLevelTransformations) )]
public sealed class ResourceManagerOptimizations : PhaseDriver
{
//
// State
//
GrowOnlyHashTable< StaticMethodRepresentation, string > m_lookup;
//
// Constructor Methods
//
public ResourceManagerOptimizations( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
this.CallsDataBase.Analyze( this.TypeSystem );
m_lookup = HashTableFactory.New< StaticMethodRepresentation, string >();
Handle_ResourceManagerImpl_GetObject1( "ResourceManagerImpl_GetObject1" );
Handle_ResourceManagerImpl_GetObject1( "ResourceManagerImpl_GetString1" );
Handle_ResourceManagerImpl_GetObject2( "ResourceManagerImpl_GetObject2" );
Handle_ResourceManagerImpl_GetObject2( "ResourceManagerImpl_GetString2" );
return this.NextPhase;
}
//--//
//
// The VS Designer generates this code pattern for resources:
//
// ///
// /// Returns the cached ResourceManager instance used by this class.
// ///
// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
// internal static global::System.Resources.ResourceManager ResourceManager {
// get {
// if (object.ReferenceEquals(resourceMan, null)) {
// global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager( , typeof(Files).Assembly);
// resourceMan = temp;
// }
// return resourceMan;
// }
// }
//
// ///
// /// Overrides the current thread's CurrentUICulture property for all
// /// resource lookups using this strongly typed resource class.
// ///
// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
// internal static global::System.Globalization.CultureInfo Culture {
// get {
// return resourceCulture;
// }
// set {
// resourceCulture = value;
// }
// }
//
// internal static {
// get {
// object obj = ResourceManager.GetObject( , resourceCulture);
// return ()(obj));
// }
// }
//
// For an application that doesn't need to support runtime localization (aka: if resourceCulture is never assigned),
// we could detect this code pattern and substitute the runtime calls with a compile-time assignment.
//
private void Handle_ResourceManagerImpl_GetObject1( string name )
{
var md = this.TypeSystem.GetWellKnownMethodNoThrow( name );
if(md != null)
{
foreach(var op in this.CallsDataBase.CallsToMethod( md ))
{
if(op.BasicBlock == null)
{
//
// Deleted call.
//
continue;
}
ConstantExpression exRes = GetActualResource( op, 1, 1 );
if(exRes != null)
{
Operator opResourceManager = op.GetPreviousOperator();
opResourceManager.Delete();
SubstituteGetObjectWithAssignment( op, exRes );
}
}
}
}
private void Handle_ResourceManagerImpl_GetObject2( string name )
{
var md = this.TypeSystem.GetWellKnownMethodNoThrow( name );
if(md != null)
{
foreach(var op in this.CallsDataBase.CallsToMethod( md ))
{
ConstantExpression exRes = GetActualResource( op, 1, 2 );
if(exRes != null)
{
Operator opCultureInfo = op.GetPreviousOperator();
Operator opResourceManager = opCultureInfo.GetPreviousOperator();
opCultureInfo.Delete();
opResourceManager.Delete();
SubstituteGetObjectWithAssignment( op, exRes );
}
}
}
}
private static void SubstituteGetObjectWithAssignment( CallOperator op ,
ConstantExpression exRes )
{
var ex = op.FirstResult;
if(ex.Type.CanBeAssignedFrom( exRes.Type, null ) == false)
{
throw TypeConsistencyErrorException.Create( "Incompatible resource type found at {0}: {1} != {2}", op.BasicBlock.ToShortString(), ex.Type, exRes.Type );
}
MethodRepresentation md = op.BasicBlock.Owner.Method;
op.SubstituteWithOperator( SingleAssignmentOperator.New( op.DebugInfo, ex, exRes ), Operator.SubstitutionFlags.Default );
md.BuildTimeFlags |= MethodRepresentation.BuildTimeAttributes.Inline;
md.BuildTimeFlags &= ~MethodRepresentation.BuildTimeAttributes.NoInline;
}
private ConstantExpression GetActualResource( CallOperator op ,
int resourceNameOffset ,
int resourceIdOffset )
{
string resourceName = GetResourceName( op, resourceNameOffset );
if(resourceName != null)
{
StaticMethodRepresentation md = FindCallToResourceManager( op, resourceIdOffset, op.BasicBlock.Owner.Method.OwnerType );
if(md != null)
{
string resourceId = ExtractResourceIdentifier( md );
object res = FindResource( resourceId, resourceName );
if(res != null)
{
return this.TypeSystem.CreateConstantFromObject( res );
}
}
}
return null;
}
private string GetResourceName( CallOperator op ,
int index )
{
if(op.Arguments.Length > index && op.Arguments[index].Type == this.TypeSystem.WellKnownTypes.System_String)
{
var ex = op.Arguments[index] as ConstantExpression;
if(ex != null)
{
var od = (DataManager.ObjectDescriptor)ex.Value;
return (string)od.Source;
}
}
return null;
}
private object FindResource( string resourceId ,
string resourceName )
{
foreach(var res in this.TypeSystem.Resources)
{
if(res.Name == resourceId)
{
foreach(var pair in res.Values)
{
if(pair.Key == resourceName)
{
return pair.Value;
}
}
}
}
return null;
}
private static StaticMethodRepresentation FindCallToResourceManager( Operator op ,
int offset ,
TypeRepresentation context )
{
while(op != null && offset-- > 0)
{
op = op.GetPreviousOperator();
}
var call = op as CallOperator;
if(call != null && call.Results.Length == 1 && call.FirstResult is TemporaryVariableExpression)
{
var md = call.TargetMethod as StaticMethodRepresentation;
if(md != null && md.Name == "get_ResourceManager" && md.OwnerType == context)
{
return md;
}
}
return null;
}
private string ExtractResourceIdentifier( StaticMethodRepresentation md )
{
string res;
if(m_lookup.TryGetValue( md, out res ) == false)
{
var cfg = TypeSystemForCodeTransformation.GetCodeForMethod( md );
if(cfg != null)
{
var wkt = this.TypeSystem.WellKnownTypes;
var td = wkt.System_Resources_ResourceManager;
foreach(var call in cfg.FilterOperators< CallOperator >())
{
var ctor = call.TargetMethod as ConstructorMethodRepresentation;
if(ctor != null && ctor.OwnerType == td)
{
if(call.Arguments.Length == 3 && call.SecondArgument.Type == wkt.System_String)
{
var ex = call.SecondArgument as ConstantExpression;
if(ex != null)
{
var od = (DataManager.ObjectDescriptor)ex.Value;
res = (string)od.Source;
m_lookup[md] = res;
break;
}
}
}
}
}
}
return res;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/SplitComplexOperators.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
//[PhaseDisabled()]
[PhaseOrdering( ExecuteAfter=typeof(ExpandAggregateTypes) )]
public sealed class SplitComplexOperators : PhaseDriver
{
//
// Constructor Methods
//
public SplitComplexOperators( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
PerformParallelExecutionOfPhase( false, true );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/CompilationSteps/Phases/TransformFinallyBlocksIntoTryBlocks.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR.CompilationSteps.Phases
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
[PhaseOrdering( ExecuteAfter=typeof(ReduceNumberOfTemporaries) )]
public sealed class TransformFinallyBlocksIntoTryBlocks : PhaseDriver
{
//
// Constructor Methods
//
public TransformFinallyBlocksIntoTryBlocks( Controller context ) : base ( context )
{
}
//
// Helper Methods
//
public override PhaseDriver Run()
{
ParallelTransformationsHandler.EnumerateFlowGraphs( this.TypeSystem, delegate( ControlFlowGraphStateForCodeTransformation cfg )
{
Transformations.TransformFinallyBlocksIntoTryBlocks.Execute( cfg );
Transformations.MergeExtendedBasicBlocks.Execute( cfg, preserveInjectionSites: true );
} );
return this.NextPhase;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation : ControlFlowGraphState
{
//
// State
//
private TypeSystemForCodeTransformation m_typeSystem;
private GrowOnlyHashTable< Expression, Expression[] > m_lookupFragments;
private GrowOnlyHashTable< string , object > m_propertyBag;
//
// Constructor Methods
//
public ControlFlowGraphStateForCodeTransformation() // Default constructor required by TypeSystemSerializer.
{
AllocateState();
}
public ControlFlowGraphStateForCodeTransformation( TypeSystemForCodeTransformation typeSystem ,
MethodRepresentation md ) : base( md )
{
m_typeSystem = typeSystem;
AllocateState();
}
protected ControlFlowGraphStateForCodeTransformation( ControlFlowGraphState source ) : base( source )
{
ControlFlowGraphStateForCodeTransformation source2 = (ControlFlowGraphStateForCodeTransformation)source;
m_typeSystem = source2.m_typeSystem;
AllocateState();
}
private void AllocateState()
{
m_lookupFragments = HashTableFactory.NewWithReferenceEquality< Expression, Expression[] >();
m_propertyBag = HashTableFactory.New < string, object >();
}
//--//
public ControlFlowGraphStateForCodeTransformation Clone( InstantiationContext ic )
{
ControlFlowGraphStateForCodeTransformation clonedCFG = new ControlFlowGraphStateForCodeTransformation( this );
CloningContext context = new CloneForwardGraph( this, clonedCFG, ic );
clonedCFG.CloneVariables( context, this );
context.Clone( m_entryBasicBlock );
return clonedCFG;
}
//--//
protected override void CloneVariables( CloningContext context ,
ControlFlowGraphState source )
{
ControlFlowGraphStateForCodeTransformation source2 = (ControlFlowGraphStateForCodeTransformation)source;
base.CloneVariables( context, source2 );
foreach(VariableExpression var in source2.DataFlow_SpanningTree_Variables)
{
CloneVariable( context, source2, var );
}
}
private VariableExpression CloneVariable( CloningContext context ,
ControlFlowGraphStateForCodeTransformation source ,
VariableExpression var )
{
VariableExpression newVar = context.LookupRegistered( var );
if(newVar == null)
{
TypeRepresentation td = var.Type;
VariableExpression.DebugInfo debugInfo = var.DebugName;
VariableExpression sourceVar = null;
uint sourceOffset = 0;
if(var is LowLevelVariableExpression)
{
LowLevelVariableExpression low = (LowLevelVariableExpression)var;
if(low.SourceVariable != null)
{
sourceVar = CloneVariable( context, source, low.SourceVariable );
sourceOffset = low.SourceOffset;
}
}
if(var is LocalVariableExpression)
{
LocalVariableExpression loc = (LocalVariableExpression)var;
newVar = AllocateLocal( td, debugInfo );
}
else if(var is TemporaryVariableExpression)
{
newVar = AllocateTemporary( td, debugInfo );
}
else if(var is ExceptionObjectVariableExpression)
{
newVar = AllocateExceptionObjectVariable( td );
}
else if(var is PhiVariableExpression)
{
PhiVariableExpression phiVar = (PhiVariableExpression)var;
VariableExpression newTarget = CloneVariable( context, source, phiVar.Target );
newVar = AllocatePhiVariable( newTarget );
}
else if(var is PseudoRegisterExpression)
{
newVar = AllocatePseudoRegister( td, debugInfo, sourceVar, sourceOffset );
}
else if(var is TypedPhysicalRegisterExpression)
{
TypedPhysicalRegisterExpression reg = (TypedPhysicalRegisterExpression)var;
newVar = AllocateTypedPhysicalRegister( td, reg.RegisterDescriptor, debugInfo, reg.SourceVariable, reg.SourceOffset );
}
else if(var is PhysicalRegisterExpression)
{
PhysicalRegisterExpression reg = (PhysicalRegisterExpression)var;
newVar = AllocatePhysicalRegister( reg.RegisterDescriptor );
}
else if(var is StackLocationExpression)
{
StackLocationExpression stack = (StackLocationExpression)var;
newVar = AllocateStackLocation( td, debugInfo, stack.Number, stack.StackPlacement, sourceVar, sourceOffset );
}
else if(var is ConditionCodeExpression)
{
newVar = AllocateConditionCode();
}
else
{
throw TypeConsistencyErrorException.Create( "Unexpected expression '{0}' during cloning of '{1}'", var, source );
}
newVar.SkipReferenceCounting = var.SkipReferenceCounting;
context.Register( var, newVar );
}
return newVar;
}
//--//
internal VariableExpression[] AllocateVariables( TypeRepresentation[] localVars ,
string[] localVarNames )
{
if(m_md.ReturnType != m_typeSystem.WellKnownTypes.System_Void)
{
m_returnValue = AllocateTemporary( m_md.ReturnType, null );
}
//--//
TypeRepresentation[] args = m_md.ThisPlusArguments;
int argsNum = args.Length;
m_arguments = new VariableExpression[argsNum];
for(int i = 0; i < argsNum; i++)
{
VariableExpression.DebugInfo debugInfo;
string[] names = m_md.ArgumentNames;
if(names != null)
{
debugInfo = new VariableExpression.DebugInfo( m_md, names[i], i, false );
}
else
{
debugInfo = null;
}
m_arguments[i] = new ArgumentVariableExpression( args[i], debugInfo, i );
//
// We want to have each argument variable assigned to on entry to the method,
// so we create an ArgumentValueOperator (see GenerateVariableInitialization)
//
Operator op = GenerateVariableInitialization( null, m_arguments[i] );
this.EntryBasicBlock.AddOperator( op );
}
//--//
VariableExpression[] locals;
if(localVars == null)
{
locals = VariableExpression.SharedEmptyArray;
}
else
{
int varsNum = localVars.Length;
locals = new VariableExpression[varsNum];
var bb = this.GetInjectionPoint( BasicBlock.Qualifier.PrologueEnd );
for(int i = 0; i < varsNum; i++)
{
VariableExpression.DebugInfo debugInfo;
if(localVarNames != null)
{
debugInfo = new VariableExpression.DebugInfo( m_md, localVarNames[i], i, true );
}
else
{
debugInfo = null;
}
locals[i] = AllocateLocal( localVars[i], debugInfo );
Operator op = GenerateVariableInitialization( null, locals[i] );
bb.AddOperator( op );
}
}
return locals;
}
//--//
//
// Helper Methods
//
public PhiVariableExpression AllocatePhiVariable( VariableExpression target )
{
PhiVariableExpression newPhi = new PhiVariableExpression( target );
TrackVariable( newPhi );
return newPhi;
}
public PseudoRegisterExpression AllocatePseudoRegister( TypeRepresentation td )
{
return AllocatePseudoRegister( td, null, null, 0 );
}
public PseudoRegisterExpression AllocatePseudoRegister( TypeRepresentation td ,
VariableExpression.DebugInfo debugInfo )
{
return AllocatePseudoRegister( td, debugInfo, null, 0 );
}
internal PseudoRegisterExpression AllocatePseudoRegister( TypeRepresentation td ,
VariableExpression.DebugInfo debugInfo ,
VariableExpression sourceVar ,
uint sourceOffset )
{
CHECKS.ASSERT( m_typeSystem.PlatformAbstraction.CanFitInRegister( td ), "Type '{0}' is too large to fit in a pseudo register", td );
PseudoRegisterExpression newPseudo = new PseudoRegisterExpression( td, debugInfo, sourceVar, sourceOffset );
TrackVariable( newPseudo );
return newPseudo;
}
public PhysicalRegisterExpression AllocatePhysicalRegister( Abstractions.RegisterDescriptor regDesc )
{
for(int pos = m_variablesCount; --pos >= 0; )
{
PhysicalRegisterExpression reg = m_variables[pos] as PhysicalRegisterExpression;
if(reg != null && !(reg is TypedPhysicalRegisterExpression) && reg.Number == regDesc.Index)
{
return reg;
}
}
TypeRepresentation td = m_typeSystem.PlatformAbstraction.GetRuntimeType( m_typeSystem, regDesc );
PhysicalRegisterExpression newReg = new PhysicalRegisterExpression( td, regDesc, null, null, 0 );
TrackVariable( newReg );
return newReg;
}
public TypedPhysicalRegisterExpression AllocateTypedPhysicalRegister( TypeRepresentation td ,
Abstractions.RegisterDescriptor regDesc ,
VariableExpression.DebugInfo debugInfo ,
VariableExpression sourceVar ,
uint sourceOffset )
{
TypedPhysicalRegisterExpression newReg = new TypedPhysicalRegisterExpression( td, regDesc, debugInfo, sourceVar, sourceOffset );
TrackVariable( newReg );
return newReg;
}
internal StackLocationExpression AllocateLocalStackLocation( TypeRepresentation td ,
VariableExpression.DebugInfo debugInfo ,
VariableExpression sourceVar ,
uint sourceOffset )
{
int wordOffset = 0;
for(int pos = m_variablesCount; --pos >= 0; )
{
StackLocationExpression stack = m_variables[pos] as StackLocationExpression;
if(stack != null && stack.StackPlacement == StackLocationExpression.Placement.Local)
{
if(wordOffset <= stack.Number)
{
wordOffset = stack.Number + 1;
}
}
}
return AllocateStackLocation( td, debugInfo, wordOffset, StackLocationExpression.Placement.Local, sourceVar, sourceOffset );
}
internal StackLocationExpression AllocateStackLocation( TypeRepresentation td ,
VariableExpression.DebugInfo debugInfo ,
int wordOffset ,
StackLocationExpression.Placement placement ,
VariableExpression sourceVar ,
uint sourceOffset )
{
StackLocationExpression newStack = new StackLocationExpression( td, debugInfo, wordOffset, placement, sourceVar, sourceOffset );
TrackVariable( newStack );
return newStack;
}
public ConditionCodeExpression AllocateConditionCode()
{
if(m_typeSystem.PlatformAbstraction.CanUseMultipleConditionCodes == false)
{
for(int pos = m_variablesCount; --pos >= 0; )
{
var cc = m_variables[pos] as ConditionCodeExpression;
if(cc != null)
{
return cc;
}
}
}
//--//
var newCC = new ConditionCodeExpression( m_typeSystem.WellKnownTypes.System_UInt32, null, 0 );
TrackVariable( newCC );
return newCC;
}
public void ApplyTransformation( TransformationContextForCodeTransformation context )
{
context.Push( this );
InnerApplyTransformation( context );
context.Transform( ref m_typeSystem );
context.Transform( ref m_lookupFragments );
context.Transform( ref m_propertyBag );
ApplyTransformation_MapToMachine( context );
context.Pop();
}
//--//
public override Operator GenerateVariableInitialization( Debugging.DebugInfo debugInfo ,
Expression var ,
TypeRepresentation td ,
bool fThroughPointer )
{
Expression ex;
if(var is ArgumentVariableExpression)
{
//
// We want to have each argument variable assigned to on entry to the method, so we create an InvalidateExpressionOperator.
//
return InitialValueOperator.New( debugInfo, (VariableExpression)var );
}
if(td is ReferenceTypeRepresentation ||
td is PointerTypeRepresentation )
{
ex = m_typeSystem.CreateNullPointer( td );
}
else
{
if(td is EnumerationTypeRepresentation)
{
td = td.UnderlyingType;
}
if(td is ScalarTypeRepresentation)
{
object val;
switch(td.BuiltInType)
{
case TypeRepresentation.BuiltInTypes.BOOLEAN: val = (System.Boolean)false; break;
case TypeRepresentation.BuiltInTypes.CHAR : val = (System.Char ) 0; break;
case TypeRepresentation.BuiltInTypes.I1 : val = (System.SByte ) 0; break;
case TypeRepresentation.BuiltInTypes.U1 : val = (System.Byte ) 0; break;
case TypeRepresentation.BuiltInTypes.I2 : val = (System.Int16 ) 0; break;
case TypeRepresentation.BuiltInTypes.U2 : val = (System.UInt16 ) 0; break;
case TypeRepresentation.BuiltInTypes.I4 : val = (System.Int32 ) 0; break;
case TypeRepresentation.BuiltInTypes.U4 : val = (System.UInt32 ) 0; break;
case TypeRepresentation.BuiltInTypes.I8 : val = (System.Int64 ) 0; break;
case TypeRepresentation.BuiltInTypes.U8 : val = (System.UInt64 ) 0; break;
case TypeRepresentation.BuiltInTypes.R4 : val = (System.Single ) 0; break;
case TypeRepresentation.BuiltInTypes.R8 : val = (System.Double ) 0; break;
case TypeRepresentation.BuiltInTypes.I : val = (System.IntPtr ) 0; break;
case TypeRepresentation.BuiltInTypes.U : val = (System.UIntPtr) 0; break;
default:
throw IncorrectEncodingException.Create( "Unexpected type {0} for {1}", td.BuiltInType, var );
}
ex = m_typeSystem.CreateConstant( td, val );
}
else
{
//
// TODO: expose a hook to allow arbitrary variable initialization policies.
//
CustomAttributeRepresentation ca;
if(m_typeSystem.MemoryMappedBitFieldPeripherals.TryGetValue( td, out ca ))
{
return GenerateVariableInitialization( debugInfo, var, ca.GetNamedArg< TypeRepresentation >( "PhysicalType" ), fThroughPointer );
}
ex = m_typeSystem.CreateConstant( td, null );
}
}
if(fThroughPointer)
{
return StoreIndirectOperator.New( debugInfo, td, var, ex, null, 0, true );
}
else
{
return SingleAssignmentOperator.New( debugInfo, (VariableExpression)var, ex );
}
}
public void DropDeadVariables()
{
m_variables = this.DataFlow_SpanningTree_Variables;
m_variablesCount = m_variables.Length;
}
public VariableExpression[] SortVariables()
{
VariableExpression[] variables = ArrayUtility.CopyNotNullArray( this.DataFlow_SpanningTree_Variables );
Array.Sort( variables, VariableExpression.GetSorter() );
return variables;
}
public override void RenumberVariables()
{
base.RenumberVariables();
GrowOnlyHashTable < VariableExpression, int > phiVersions = null;
int numPhi = 0;
int numPseudo = 0;
int numCC = 0;
for(int pos = m_variablesCount; --pos >= 0; )
{
VariableExpression var = m_variables[pos] as VariableExpression;
if(var is PhiVariableExpression)
{
PhiVariableExpression varPhi = (PhiVariableExpression)var;
int version;
if(phiVersions == null)
{
phiVersions = HashTableFactory.NewWithReferenceEquality< VariableExpression, int >();
}
int maxVersion;
if(phiVersions.TryGetValue( varPhi.Target, out maxVersion ))
{
version = maxVersion + 1;
}
else
{
version = 1;
}
varPhi.Version = version;
phiVersions[varPhi.Target] = version;
var.Number = numPhi++;
}
else if(var is PseudoRegisterExpression)
{
var.Number = numPseudo++;
}
else if(var is StackLocationExpression)
{
}
else if(var is ConditionCodeExpression)
{
var.Number = numCC++;
}
}
}
//--//
public override BasicBlock GetInjectionPoint( BasicBlock.Qualifier qualifier )
{
foreach(BasicBlock bb in this.DataFlow_SpanningTree_BasicBlocks)
{
if(bb.Annotation == qualifier)
{
return bb;
}
}
bool fAddAfter;
switch(qualifier)
{
case BasicBlock.Qualifier.Entry:
return this.EntryBasicBlock;
case BasicBlock.Qualifier.PrologueStart:
case BasicBlock.Qualifier.PrologueEnd:
case BasicBlock.Qualifier.EntryInjectionStart:
case BasicBlock.Qualifier.EntryInjectionEnd:
fAddAfter = true;
break;
case BasicBlock.Qualifier.ExitInjectionStart:
case BasicBlock.Qualifier.ExitInjectionEnd:
case BasicBlock.Qualifier.EpilogueStart:
case BasicBlock.Qualifier.EpilogueEnd:
fAddAfter = false;
break;
case BasicBlock.Qualifier.Exit:
return this.ExitBasicBlock;
default:
return null;
}
BasicBlock res;
if(fAddAfter)
{
var targetBB = GetInjectionPoint( qualifier - 1 );
CHECKS.ASSERT( targetBB.Successors.Length == 1, "Internal failure: entry basic block has more than one successor in '{0}'", this );
res = targetBB.InsertNewSuccessor( targetBB.FirstSuccessor );
}
else
{
var targetBB = GetInjectionPoint( qualifier + 1 );
if(targetBB == null)
{
return null;
}
res = targetBB.InsertNewPredecessor();
}
res.Annotation = qualifier;
return res;
}
//--//
public bool HasProperty( string key )
{
return m_propertyBag.ContainsKey( key );
}
public object GetPropertyValue( string key )
{
object res;
m_propertyBag.TryGetValue( key, out res );
return res;
}
public bool SetPropertyValue( string key ,
object value )
{
return m_propertyBag.Update( key, value );
}
public bool SetProperty( string key )
{
return SetPropertyValue( key, null );
}
//--//
//
// Access Methods
//
public override TypeSystemForIR TypeSystemForIR
{
get
{
return m_typeSystem;
}
}
public TypeSystemForCodeTransformation TypeSystem
{
get
{
return m_typeSystem;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_CompilationConstraintsLookup.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
struct MergeHelper
{
//
// State
//
CompilationConstraints[] m_array1;
CompilationConstraints[] m_array2;
CompilationConstraints[] m_arrayRes;
//
// Helper Methods
//
internal void Init( CompilationConstraints[] array1 ,
CompilationConstraints[] array2 )
{
m_array1 = array1;
m_array2 = array2;
m_arrayRes = SharedEmptyCompilationConstraintsArray;
}
internal void Apply( params CompilationConstraints[] ccFilter )
{
foreach(CompilationConstraints cc in ccFilter)
{
if(HasCompilationConstraint( m_array1, cc ) ||
HasCompilationConstraint( m_array2, cc ) )
{
m_arrayRes = AddCompilationConstraint( m_arrayRes, cc );
return;
}
}
}
//
// Access Methods
//
internal CompilationConstraints[] Result
{
get
{
return m_arrayRes;
}
}
}
struct ConvertHelper
{
//
// State
//
private CompilationConstraints[] m_ccPre;
private CompilationConstraints[] m_ccPost;
internal CompilationConstraints[] m_ccResult;
//
// Helper Methods
//
internal void Init( CompilationConstraints[] ccPre ,
CompilationConstraints[] ccPost )
{
m_ccPre = ccPre;
m_ccPost = ccPost;
m_ccResult = ControlFlowGraphState.SharedEmptyCompilationConstraintsArray;
}
internal void Apply( params CompilationConstraints[] ccFilter )
{
foreach(CompilationConstraints cc in ccFilter)
{
if(HasCompilationConstraint( m_ccPost, cc ))
{
m_ccResult = AddCompilationConstraint( m_ccResult, cc );
return;
}
}
foreach(CompilationConstraints cc in ccFilter)
{
if(HasCompilationConstraint( m_ccPre, cc ))
{
m_ccResult = AddCompilationConstraint( m_ccResult, cc );
return;
}
}
}
}
struct DeltaHelper
{
//
// State
//
private CompilationConstraints[] m_ccPre;
private CompilationConstraints[] m_ccPost;
internal CompilationConstraints[] m_ccSet;
internal CompilationConstraints[] m_ccReset;
internal bool m_fNotEmpty;
//
// Helper Methods
//
internal void Init( CompilationConstraints[] ccPre ,
CompilationConstraints[] ccPost )
{
m_ccPre = ccPre;
m_ccPost = ccPost;
m_ccSet = ControlFlowGraphState.SharedEmptyCompilationConstraintsArray;
m_ccReset = ControlFlowGraphState.SharedEmptyCompilationConstraintsArray;
m_fNotEmpty = false;
}
internal void Apply( params CompilationConstraints[] ccFilter )
{
CompilationConstraints ccPre;
CompilationConstraints ccPost;
bool fGotPre = HasAnyCompilationConstraint( m_ccPre , out ccPre , ccFilter );
bool fGotPost = HasAnyCompilationConstraint( m_ccPost, out ccPost, ccFilter );
if(fGotPre && fGotPost)
{
if(ccPre == ccPost)
{
return;
}
}
if(fGotPre)
{
m_ccReset = ControlFlowGraphState.AddCompilationConstraint( m_ccReset, ccPre );
m_fNotEmpty = true;
}
if(fGotPost)
{
m_ccSet = ControlFlowGraphState.AddCompilationConstraint( m_ccSet, ccPost );
m_fNotEmpty = true;
}
}
static bool Find( CompilationConstraints[] ccTarget ,
CompilationConstraints[] ccFilter ,
out CompilationConstraints match )
{
foreach(CompilationConstraints cc in ccFilter)
{
if(HasCompilationConstraint( ccTarget, cc ))
{
match = cc;
return true;
}
}
match = default(CompilationConstraints);
return false;
}
}
//--//
//
// State
//
//
// Constructor Methods
//
//
// Helper Methods
//
public bool EnforceCompilationConstraints( List< CallOperator > toBeInlined )
{
GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht = HashTableFactory.NewWithReferenceEquality< BasicBlock, CompilationConstraints[] >();
return PropagateCompilationConstraints( ht, this.EntryBasicBlock, this.CompilationConstraintsArray, toBeInlined );
}
public GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > PropagateCompilationConstraints( CompilationConstraints[] ccStart )
{
GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht = HashTableFactory.NewWithReferenceEquality< BasicBlock, CompilationConstraints[] >();
if(PropagateCompilationConstraints( ht, this.EntryBasicBlock, ccStart, null ))
{
return ht;
}
return null;
}
private static bool PropagateCompilationConstraints( GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht ,
BasicBlock bb ,
CompilationConstraints[] ccArray ,
List< CallOperator > toBeInlined )
{
CompilationConstraints[] ccArrayOld;
if(ht.TryGetValue( bb, out ccArrayOld ))
{
if(SameCompilationConstraints( ccArrayOld, ccArray ))
{
return true;
}
//--//
MergeHelper helper = new MergeHelper();
helper.Init( ccArray, ccArrayOld );
helper.Apply( CompilationConstraints.Allocations_OFF ,
CompilationConstraints.Allocations_ON );
helper.Apply( CompilationConstraints.StackAccess_OFF ,
CompilationConstraints.StackAccess_ON );
helper.Apply( CompilationConstraints.BoundsChecks_OFF_DEEP ,
CompilationConstraints.BoundsChecks_OFF ,
CompilationConstraints.BoundsChecks_ON );
helper.Apply( CompilationConstraints.NullChecks_OFF_DEEP ,
CompilationConstraints.NullChecks_OFF ,
CompilationConstraints.NullChecks_ON );
ccArray = helper.Result;
}
ht[bb] = ccArray;
ccArray = PropagateCompilationConstraintsThroughOperators( bb, ccArray, null, toBeInlined );
if(ccArray == null)
{
return false;
}
foreach(BasicBlockEdge edge in bb.Successors)
{
if(!PropagateCompilationConstraints( ht, edge.Successor, ccArray, toBeInlined ))
{
return false;
}
}
return true;
}
private static CompilationConstraints[] PropagateCompilationConstraintsThroughOperators( BasicBlock bb ,
CompilationConstraints[] ccArray ,
Operator opStopAt ,
List< CallOperator > toBeInlined )
{
foreach(Operator op in bb.Operators)
{
if(op == opStopAt)
{
break;
}
if(op is CallOperator)
{
CallOperator call = (CallOperator)op;
if(toBeInlined != null)
{
if(HasCompilationConstraint( ccArray, CompilationConstraints.StackAccess_OFF ))
{
if(call.CallType == CallOperator.CallKind.Virtual)
{
throw TypeConsistencyErrorException.Create( "Found a virtual method call '{0}' in a StackNotAvailable context: '{1}'", call.TargetMethod, bb.Owner.Method );
}
if(call.TargetMethod.HasBuildTimeFlag( MethodRepresentation.BuildTimeAttributes.NoInline ))
{
//
// TODO: Should we ignore the attribute??
//
}
else
{
toBeInlined.Add( call );
return null;
}
}
if(HasCompilationConstraint( ccArray, CompilationConstraints.Allocations_OFF ))
{
//
// TODO: This cannot be properly processed here, we'd need to have fully expanded the callee to analyze it properly...
//
}
}
if(call.TargetMethod.HasBuildTimeFlag( MethodRepresentation.BuildTimeAttributes.CanAllocateOnReturn ))
{
ccArray = RemoveCompilationConstraint( ccArray, CompilationConstraints.Allocations_OFF );
ccArray = AddCompilationConstraint ( ccArray, CompilationConstraints.Allocations_ON );
}
}
else
{
if(toBeInlined != null)
{
if(op.MayAllocateStorage && HasCompilationConstraint( ccArray, CompilationConstraints.Allocations_OFF ))
{
throw TypeConsistencyErrorException.Create( "Allocating operator '{0}' found in a CannotAllocate context: '{1}'", op, bb.Owner.Method );
}
}
}
if(op is CompilationConstraintsOperator)
{
CompilationConstraintsOperator ccOp = (CompilationConstraintsOperator)op;
ccArray = ccOp.TransformCompilationConstraints( ccArray );
}
}
return ccArray;
}
//--//
public static CompilationConstraints[] ComposeCompilationConstraints( CompilationConstraints[] ccPre ,
CompilationConstraints[] ccPost )
{
ConvertHelper cnvHelper = new ConvertHelper();
cnvHelper.Init( ccPre, ccPost );
cnvHelper.Apply( CompilationConstraints.Allocations_OFF ,
CompilationConstraints.Allocations_ON );
cnvHelper.Apply( CompilationConstraints.StackAccess_OFF ,
CompilationConstraints.StackAccess_ON );
cnvHelper.Apply( CompilationConstraints.BoundsChecks_OFF_DEEP ,
CompilationConstraints.BoundsChecks_OFF ,
CompilationConstraints.BoundsChecks_ON );
cnvHelper.Apply( CompilationConstraints.NullChecks_OFF_DEEP ,
CompilationConstraints.NullChecks_OFF ,
CompilationConstraints.NullChecks_ON );
return cnvHelper.m_ccResult;
}
public static bool ComputeDeltaBetweenCompilationConstraints( CompilationConstraints[] ccPre ,
CompilationConstraints[] ccPost ,
out CompilationConstraints[] ccSet ,
out CompilationConstraints[] ccReset )
{
DeltaHelper dltHelper = new DeltaHelper();
dltHelper.Init( ccPre, ccPost );
dltHelper.Apply( CompilationConstraints.Allocations_OFF ,
CompilationConstraints.Allocations_ON );
dltHelper.Apply( CompilationConstraints.StackAccess_OFF ,
CompilationConstraints.StackAccess_ON );
dltHelper.Apply( CompilationConstraints.BoundsChecks_OFF_DEEP ,
CompilationConstraints.BoundsChecks_OFF ,
CompilationConstraints.BoundsChecks_ON );
dltHelper.Apply( CompilationConstraints.NullChecks_OFF_DEEP ,
CompilationConstraints.NullChecks_OFF ,
CompilationConstraints.NullChecks_ON );
ccSet = dltHelper.m_ccSet;
ccReset = dltHelper.m_ccReset;
return dltHelper.m_fNotEmpty;
}
//--//
public CompilationConstraints[] CompilationConstraintsAtBasicBlockEntry( BasicBlock bb )
{
GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht = PropagateCompilationConstraints( this.CompilationConstraintsArray );
if(ht == null)
{
throw TypeConsistencyErrorException.Create( "Cannot propagate compilation constraints in {0}", this );
}
return CompilationConstraintsAtBasicBlockEntry( ht, bb );
}
public static CompilationConstraints[] CompilationConstraintsAtBasicBlockEntry( GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht ,
BasicBlock bb )
{
CompilationConstraints[] res;
if(ht.TryGetValue( bb, out res ) == false)
{
res = ControlFlowGraphState.SharedEmptyCompilationConstraintsArray;
}
return res;
}
public static CompilationConstraints[] CompilationConstraintsAtBasicBlockExit( GrowOnlyHashTable< BasicBlock, CompilationConstraints[] > ht ,
BasicBlock bb )
{
CompilationConstraints[] res = CompilationConstraintsAtBasicBlockEntry( ht, bb );
res = PropagateCompilationConstraintsThroughOperators( bb, res, null, null );
if(res == null)
{
throw TypeConsistencyErrorException.Create( "Cannot propagate compilation constraints in {0} to basic block {1}", bb.Owner, bb );
}
return res;
}
public CompilationConstraints[] CompilationConstraintsAtOperator( Operator op )
{
CompilationConstraints[] res = CompilationConstraintsAtBasicBlockEntry( op.BasicBlock );
res = PropagateCompilationConstraintsThroughOperators( op.BasicBlock, res, op, null );
if(res == null)
{
throw TypeConsistencyErrorException.Create( "Cannot propagate compilation constraints in {0} to operator {1}", this, op );
}
return res;
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_Dominance.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_Dominance : CachedInfo
{
//
// State
//
internal DataFlow.ControlTree.Dominance m_dominance;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "Dominance" ))
{
m_dominance = new DataFlow.ControlTree.Dominance( cfg );
}
}
}
//
// Helper Methods
//
public IDisposable LockDominance()
{
var ci = GetCachedInfo< CacheInfo_Dominance >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BasicBlock[] DataFlow_ImmediateDominators
{
get
{
var ci = GetCachedInfo< CacheInfo_Dominance >();
return ci.m_dominance.GetImmediateDominators();
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_Dominance
{
get
{
var ci = GetCachedInfo< CacheInfo_Dominance >();
return ci.m_dominance.GetDominance();
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_DominanceFrontier
{
get
{
var ci = GetCachedInfo< CacheInfo_Dominance >();
return ci.m_dominance.GetDominanceFrontier();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_Liveness.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_Liveness : CachedInfo
{
//
// State
//
internal DataFlow.LivenessAnalysis m_liveness;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "Liveness" ))
{
m_liveness = DataFlow.LivenessAnalysis.Compute( cfg, false );
}
}
}
//
// Helper Methods
//
public IDisposable LockLiveness()
{
var ci = GetCachedInfo< CacheInfo_Liveness >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_LivenessAtBasicBlockEntry // It's indexed as [][]
{
get
{
var ci = GetCachedInfo< CacheInfo_Liveness >();
return ci.m_liveness.LivenessAtBasicBlockEntry;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_LivenessAtBasicBlockExit // It's indexed as [][]
{
get
{
var ci = GetCachedInfo< CacheInfo_Liveness >();
return ci.m_liveness.LivenessAtBasicBlockExit;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_LivenessAtOperator // It's indexed as [][]
{
get
{
var ci = GetCachedInfo< CacheInfo_Liveness >();
return ci.m_liveness.LivenessAtOperator;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_VariableLivenessMap // It's indexed as [][]
{
get
{
var ci = GetCachedInfo< CacheInfo_Liveness >();
return ci.m_liveness.VariableLivenessMap;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_MapToMachine.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
const string MappedToMachine = "VariablesMappedToMachine";
public class ValueFragment : ITransformationContextTarget
{
//
// State
//
private object m_target;
private uint m_offset;
//
// Constructor Methods
//
internal ValueFragment( object target ,
uint offset )
{
m_target = target;
m_offset = offset;
}
//
// Helper Methods
//
void ITransformationContextTarget.ApplyTransformation( TransformationContext context )
{
context.Push( this );
context.Transform( ref m_target );
context.Transform( ref m_offset );
context.Pop();
}
//--//
//
// Access Methods
//
public uint Value
{
get
{
return DataConversion.GetFragmentOfNumber( m_target, (int)m_offset );
}
}
//
// Debug Methods
//
public override string ToString()
{
return string.Format( "", m_offset, m_target );
}
}
//
// State
//
private Abstractions.CallingConvention.CallState m_callState;
//
// Constructor Methods
//
//--//
//
// Helper Methods
//
private void ApplyTransformation_MapToMachine( TransformationContextForCodeTransformation context )
{
context.TransformGeneric( ref m_callState );
}
//--//--//--//--//--//--//--//
internal void MapVariables()
{
if(SetProperty( MappedToMachine ) == false)
{
m_callState = m_typeSystem.CallingConvention.CreateCallState( Abstractions.CallingConvention.Direction.Callee );
Operator insertionOp = this.GetInjectionPoint( BasicBlock.Qualifier.PrologueEnd ).FirstOperator;
MapIncomingArgumentsBasedOnCallingConvention( insertionOp );
MapTheRestOfTheVariables ( insertionOp );
RemoveOldArgumentValueOperators ( this.EntryBasicBlock );
AddInvalidateOperatorsToExceptionHandlers();
}
}
//--//--//--//--//--//--//--//
private void MapIncomingArgumentsBasedOnCallingConvention( Operator insertionOp )
{
Abstractions.CallingConvention cc = m_typeSystem.CallingConvention;
Expression[] fragments = cc.AssignReturnValue( this, insertionOp, m_returnValue, m_callState );
if(fragments != null)
{
SetFragmentsForExpression( m_returnValue, fragments );
}
///
/// Do not add 'this' pointer as part of the incoming arguments for exported methods
///
bool fAddCurrentArg = 0 == (this.Method.BuildTimeFlags & MethodRepresentation.BuildTimeAttributes.Exported);
foreach(VariableExpression exArg in m_arguments)
{
if(fAddCurrentArg)
{
SetFragmentsForExpression( exArg, cc.AssignArgument( this, insertionOp, exArg, m_callState ) );
}
fAddCurrentArg = true;
}
}
private void MapTheRestOfTheVariables( Operator insertingOp )
{
VariableExpression [] vars = this.DataFlow_SpanningTree_Variables;
VariableExpression.Property[] varProps = this.DataFlow_PropertiesOfVariables;
for(int i = 0; i < vars.Length; i++)
{
VariableExpression var = vars[i];
if(m_typeSystem.GetLevel( var ) <= Operator.OperatorLevel.ScalarValues)
{
//
// Only high-level expressions need to be mapped.
//
continue;
}
Expression[] fragments = GetFragmentsForExpression( var );
Expression[] fragmentsNew;
//
// Any variable that is bigger than 64 bits or whose address is taken must be allocated on the stack.
//
if((varProps[i] & VariableExpression.Property.AddressTaken) != 0 || var.Type.SizeOfHoldingVariableInWords > 2)
{
bool fAllocate;
if(fragments == null)
{
fAllocate = true;
}
else
{
fAllocate = false;
foreach(Expression fragment in fragments)
{
if(!(fragment is StackLocationExpression))
{
fAllocate = true;
break;
}
}
}
if(fAllocate)
{
fragmentsNew = MapExpressionToFragments( null, var.DebugName, var, m_callState, KindOfFragment.AllocateStackLocalLocation );
}
else
{
fragmentsNew = null;
}
}
else if(fragments == null)
{
fragmentsNew = MapExpressionToFragments( null, var.DebugName, var, m_callState, KindOfFragment.AllocatePseudoRegister );
}
else
{
fragmentsNew = null;
}
if(fragmentsNew != null)
{
SetFragmentsForExpression( var, fragmentsNew );
if(fragments != null)
{
CHECKS.ASSERT( fragments.Length == fragmentsNew.Length, "Cannot copy between different-sized expressions" );
//
// Insert assignment ops for all the variables that have been reassigned.
//
for(int fragIdx = 0; fragIdx < fragments.Length; fragIdx++)
{
Expression src = fragments [fragIdx];
Expression dst = fragmentsNew[fragIdx];
if(src != dst)
{
insertingOp.AddOperatorBefore( SingleAssignmentOperator.New( null, (VariableExpression)dst, src ) );
}
}
}
}
}
}
private void RemoveOldArgumentValueOperators( BasicBlock bb )
{
//
// Arguments are passed through an invalidation operator, so that they appear always assigned to.
// We need to remove these operators, since now we have equivalent ones for the fragments.
//
foreach(Operator op in bb.Operators)
{
if(op is InitialValueOperator)
{
if(ArrayUtility.FindReferenceInNotNullArray( m_arguments, op.FirstResult ) >= 0)
{
op.Delete();
}
}
}
}
private void AddInvalidateOperatorsToExceptionHandlers()
{
foreach(BasicBlock bb in m_basicBlocks)
{
if(bb is ExceptionHandlerBasicBlock)
{
var op = NopOperator.New( null );
bb.FirstOperator.AddOperatorBefore( op );
foreach(VariableExpression exToInvalidate in m_typeSystem.CallingConvention.CollectExpressionsToInvalidate( this, null, null ))
{
op.AddAnnotation( PostInvalidationAnnotation.Create( m_typeSystem, exToInvalidate ) );
}
}
}
}
//--//--//--//--//--//--//--//
public enum KindOfFragment
{
CopyIncomingArgumentFromPhysicalToPseudoRegister,
CopyIncomingArgumentFromStackToPseudoRegister ,
AllocatePhysicalRegisterForArgument ,
AllocatePhysicalRegisterForReturnValue ,
AllocatePseudoRegister ,
AllocateStackInLocation ,
AllocateStackLocalLocation ,
AllocateStackOutLocation ,
}
public Expression[] MapExpressionToFragments( Operator insertionOp ,
VariableExpression.DebugInfo debugInfo ,
VariableExpression sourceVar ,
Abstractions.CallingConvention.CallState callState ,
KindOfFragment kind )
{
return MapExpressionToFragments( insertionOp, debugInfo, sourceVar, sourceVar.Type, callState, kind );
}
public Expression[] MapExpressionToFragments( Operator insertionOp ,
VariableExpression.DebugInfo debugInfo ,
VariableExpression sourceVar ,
TypeRepresentation sourceTd ,
Abstractions.CallingConvention.CallState callState ,
KindOfFragment kind )
{
uint sourceFragments;
bool fDirect;
m_typeSystem.PlatformAbstraction.ComputeNumberOfFragmentsForExpression( sourceTd, kind, out sourceFragments, out fDirect );
Expression[] res = new Expression[sourceFragments];
TypeRepresentation genericTd = m_typeSystem.WellKnownTypes.System_UInt32;
Abstractions.Platform pa = m_typeSystem.PlatformAbstraction;
for(uint offset = 0; offset < sourceFragments; offset++)
{
uint sourceOffset = offset * sizeof(uint);
TypeRepresentation fragmentTd;
Expression exFragment;
if(fDirect)
{
fragmentTd = sourceTd;
}
else if(sourceTd is ScalarTypeRepresentation && sourceFragments == 1)
{
fragmentTd = sourceTd;
}
else
{
fragmentTd = genericTd;
InstanceFieldRepresentation fd = sourceTd.FindFieldAtOffset( (int)sourceOffset );
if(fd != null)
{
TypeRepresentation fieldTd = fd.FieldType;
if(fieldTd.SizeOfHoldingVariable == genericTd.SizeOfHoldingVariable)
{
fragmentTd = fieldTd;
}
}
}
switch(kind)
{
case KindOfFragment.CopyIncomingArgumentFromPhysicalToPseudoRegister:
{
exFragment = AllocatePseudoRegister( fragmentTd, debugInfo, sourceVar, sourceOffset );
//
// Invalidate the physical register and then copy it to pseudo one.
//
TypedPhysicalRegisterExpression exReg = AllocateTypedPhysicalRegister( fragmentTd, callState.GetNextRegister( pa, sourceTd, fragmentTd, kind ), debugInfo, sourceVar, sourceOffset );
var opNew = SingleAssignmentOperator.New( insertionOp.DebugInfo, (VariableExpression)exFragment, exReg );
insertionOp.AddOperatorBefore( opNew );
//
// Don't copy propagate the input registers.
//
opNew.AddAnnotation( BlockCopyPropagationAnnotation.Create( this.TypeSystem, 0, false, false ) );
//
// This pointer is always not null.
//
if(this.Method is InstanceMethodRepresentation && sourceVar == this.Arguments[0])
{
opNew.AddAnnotation( NotNullAnnotation.Create( this.TypeSystem ) );
}
var opTarget = GetTarget( insertionOp );
opTarget.AddOperatorBefore( InitialValueOperator.New( insertionOp.DebugInfo, exReg ) );
}
break;
case KindOfFragment.CopyIncomingArgumentFromStackToPseudoRegister:
{
exFragment = AllocatePseudoRegister( fragmentTd, debugInfo, sourceVar, sourceOffset );
StackLocationExpression exStack = AllocateStackLocation( fragmentTd, debugInfo, callState.GetNextIndex( pa, sourceTd, fragmentTd, kind ), StackLocationExpression.Placement.In, sourceVar, sourceOffset );
insertionOp.AddOperatorBefore( SingleAssignmentOperator.New( insertionOp.DebugInfo, (VariableExpression)exFragment, exStack ) );
Operator opTarget = GetTarget( insertionOp );
opTarget.AddOperatorBefore( InitialValueOperator.New( insertionOp.DebugInfo, exStack ) );
}
break;
case KindOfFragment.AllocatePhysicalRegisterForArgument:
case KindOfFragment.AllocatePhysicalRegisterForReturnValue:
exFragment = AllocateTypedPhysicalRegister( fragmentTd, callState.GetNextRegister( pa, sourceTd, fragmentTd, kind ), debugInfo, sourceVar, sourceOffset );
break;
case KindOfFragment.AllocatePseudoRegister:
exFragment = AllocatePseudoRegister( fragmentTd, debugInfo, sourceVar, sourceOffset );
break;
case KindOfFragment.AllocateStackInLocation:
case KindOfFragment.AllocateStackLocalLocation:
case KindOfFragment.AllocateStackOutLocation:
{
StackLocationExpression.Placement stackPlacement;
if (kind == KindOfFragment.AllocateStackInLocation ) stackPlacement = StackLocationExpression.Placement.In;
else if(kind == KindOfFragment.AllocateStackLocalLocation) stackPlacement = StackLocationExpression.Placement.Local;
else stackPlacement = StackLocationExpression.Placement.Out;
StackLocationExpression exStack = AllocateStackLocation( fragmentTd, debugInfo, callState.GetNextIndex( pa, sourceTd, fragmentTd, kind ), stackPlacement, sourceVar, sourceOffset );
if(kind == KindOfFragment.AllocateStackInLocation)
{
Operator opTarget = GetTarget( insertionOp );
opTarget.AddOperatorBefore( InitialValueOperator.New( insertionOp.DebugInfo, exStack ) );
}
exFragment = exStack;
}
break;
default:
exFragment = null;
break;
}
res[offset] = exFragment;
}
return res;
}
private static Operator GetTarget( Operator op )
{
return op.BasicBlock.Owner.EntryBasicBlock.GetFirstDifferentOperator( typeof(InitialValueOperator) );
}
//--//
public Expression[][] GetFragmentsForExpressionArray( Expression[] exArray )
{
var res = new Expression[exArray.Length][];
for(int i = 0; i < exArray.Length; i++)
{
res[i] = GetFragmentsForExpression( exArray[i] );
}
return res;
}
public Expression[] GetFragmentsForExpression( Expression ex )
{
Expression[] res;
if(m_lookupFragments.TryGetValue( ex, out res ) == false)
{
if(ex is LowLevelVariableExpression)
{
res = new Expression[] { ex };
SetFragmentsForExpression( ex, res );
}
else if(ex is ConstantExpression)
{
ConstantExpression exConst = (ConstantExpression)ex;
TypeRepresentation td = exConst.Type;
object val = exConst.Value;
uint sourceFragments;
bool fDirect;
m_typeSystem.PlatformAbstraction.ComputeNumberOfFragmentsForExpression( td, KindOfFragment.AllocatePseudoRegister, out sourceFragments, out fDirect );
res = new Expression[sourceFragments];
if(sourceFragments == 1 && m_typeSystem.GetLevel( exConst ) <= Operator.OperatorLevel.ScalarValues)
{
res[0] = exConst;
}
else
{
TypeRepresentation genericTd = m_typeSystem.WellKnownTypes.System_UInt32;
for(uint offset = 0; offset < sourceFragments; offset++)
{
uint byteOffset = offset * sizeof(uint);
InstanceFieldRepresentation fd = td.FindFieldAtOffset( (int)byteOffset );
TypeRepresentation fragmentTd = genericTd;
if(fd != null)
{
TypeRepresentation fieldTd = fd.FieldType;
if(fieldTd.SizeOfHoldingVariable == fragmentTd.SizeOfHoldingVariable)
{
fragmentTd = fieldTd;
}
}
object valFrag;
ulong valInt;
if(exConst.IsValueInteger && exConst.GetAsRawUlong( out valInt ))
{
CHECKS.ASSERT( exConst.SizeOfValue == sourceFragments * sizeof(uint), "Mismatch between type and value of ConstantExpression: {0} <=> {1}", exConst.Type, exConst.Value );
if(offset == 0)
{
fragmentTd = m_typeSystem.WellKnownTypes.System_UInt32;
valFrag = (uint)valInt;
}
else
{
if(exConst.IsValueSigned)
{
fragmentTd = m_typeSystem.WellKnownTypes.System_Int32;
valFrag = (int)(valInt >> 32);
}
else
{
fragmentTd = m_typeSystem.WellKnownTypes.System_UInt32;
valFrag = (uint)(valInt >> 32);
}
}
}
else
{
valFrag = new ValueFragment( val, offset );
}
res[offset] = new ConstantExpression( fragmentTd, valFrag );
}
}
SetFragmentsForExpression( exConst, res );
}
}
return res;
}
internal void SetFragmentsForExpression( Expression ex ,
Expression[] fragments )
{
m_lookupFragments[ex] = fragments;
}
//--//
//
// Access Methods
//
public bool IsMappedToMachine
{
get
{
return HasProperty( MappedToMachine );
}
}
//--//
//
// Debug Methods
//
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_PostDominance.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_PostDominance : CachedInfo
{
//
// State
//
internal DataFlow.ControlTree.PostDominance m_postDominance;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "PostDominance" ))
{
m_postDominance = new DataFlow.ControlTree.PostDominance( cfg );
}
}
}
//
// Helper Methods
//
public IDisposable LockPostDominance()
{
var ci = GetCachedInfo< CacheInfo_PostDominance >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_PostDominance
{
get
{
var ci = GetCachedInfo< CacheInfo_PostDominance >();
return ci.m_postDominance.GetPostDominance();
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BasicBlock[] DataFlow_ImmediatePostDominators
{
get
{
var ci = GetCachedInfo< CacheInfo_PostDominance >();
return ci.m_postDominance.GetImmediatePostDominators();
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_PostOrderVisit.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_PostOrderVisit : CachedInfo
{
//
// State
//
internal BasicBlock[] m_basicBlocks;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "PostOrderVisit" ))
{
cfg.UpdateFlowInformation();
DataFlow.ControlTree.PostOrderVisit.Compute( cfg.m_entryBasicBlock, out m_basicBlocks );
}
}
}
//
// Helper Methods
//
public IDisposable LockPostOrderVisit()
{
var ci = GetCachedInfo< CacheInfo_PostOrderVisit >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BasicBlock[] DataFlow_PostOrderVisit
{
get
{
var ci = GetCachedInfo< CacheInfo_PostOrderVisit >();
return ci.m_basicBlocks;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_PropertiesOfVariables.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_PropertiesOfVariables : CachedInfo
{
//
// State
//
internal VariableExpression.Property[] m_propertiesOfVariables;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "PropertiesOfVariables" ))
{
Operator [] operators = cfg.DataFlow_SpanningTree_Operators;
VariableExpression [] variables = cfg.DataFlow_SpanningTree_Variables;
VariableExpression.Property[] properties = new VariableExpression.Property[variables.Length];
foreach(VariableExpression var in variables)
{
if(var.AliasedVariable is PhysicalRegisterExpression)
{
properties[var.SpanningTreeIndex] |= VariableExpression.Property.PhysicalRegister;
}
}
foreach(Operator op in operators)
{
if(op is AddressAssignmentOperator)
{
ExpandAddressTakenThroughFragments( cfg, variables, properties, op.FirstArgument );
}
}
m_propertiesOfVariables = properties;
}
}
private static void ExpandAddressTakenThroughFragments( ControlFlowGraphStateForCodeTransformation cfg ,
VariableExpression[] variables ,
VariableExpression.Property[] properties ,
Expression ex )
{
if(ex is VariableExpression)
{
CHECKS.ASSERT( ex.SpanningTreeIndex != -1, "Encountered variable not belonging to the spanning tree: {0}", ex );
if((properties[ex.SpanningTreeIndex] & VariableExpression.Property.AddressTaken) == 0)
{
properties[ex.SpanningTreeIndex] |= VariableExpression.Property.AddressTaken;
//
// Expand from fragment to original variable.
//
Expression[] fragments;
if(ex is LowLevelVariableExpression)
{
LowLevelVariableExpression exLow = (LowLevelVariableExpression)ex;
fragments = cfg.GetFragmentsForExpression( exLow.SourceVariable );
}
else
{
fragments = cfg.GetFragmentsForExpression( ex );
}
if(fragments != null)
{
//
// Expand to all the fragments.
//
foreach(Expression var in fragments)
{
ExpandAddressTakenThroughFragments( cfg, variables, properties, var );
}
}
}
}
}
}
//
// Helper Methods
//
public IDisposable LockPropertiesOfVariables()
{
var ci = GetCachedInfo< CacheInfo_PropertiesOfVariables >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public VariableExpression.Property[] DataFlow_PropertiesOfVariables
{
get
{
var ci = GetCachedInfo< CacheInfo_PropertiesOfVariables >();
return ci.m_propertiesOfVariables;
}
}
//
// Debug Methods
//
public override string ToPrettyString( Operator op )
{
return PrettyDumper.Dump( op );
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_ReachingDefinitions.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_ReachingDefinitions : CachedInfo
{
//
// State
//
internal BitVector[] m_reachingDefinitions;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "ReachingDefinitions" ))
{
DataFlow.ReachingDefinitions.Compute( cfg.DataFlow_SpanningTree_BasicBlocks, cfg.DataFlow_SpanningTree_Operators, true, out m_reachingDefinitions );
}
}
}
//
// Helper Methods
//
public IDisposable LockReachingDefinitions()
{
var ci = GetCachedInfo< CacheInfo_ReachingDefinitions >();
ci.Lock();
return ci;
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BitVector[] DataFlow_ReachingDefinitions
{
get
{
var ci = GetCachedInfo< CacheInfo_ReachingDefinitions >();
return ci.m_reachingDefinitions;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_SpanningTree.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation
{
class CacheInfo_SpanningTree : CachedInfo
{
//
// State
//
internal BasicBlock[] m_basicBlocks;
internal BasicBlock[] m_ancestors;
internal Operator[] m_operators;
internal VariableExpression[] m_variables;
internal VariableExpression[][] m_variablesByStorage;
internal VariableExpression[][] m_variablesByAggregate;
//
// Helper Methods
//
protected override void Update()
{
ControlFlowGraphStateForCodeTransformation cfg = (ControlFlowGraphStateForCodeTransformation)m_owner;
using(new PerformanceCounters.ContextualTiming( cfg, "SpanningTree" ))
{
while(true)
{
cfg.UpdateFlowInformation();
foreach(BasicBlock bb in cfg.m_basicBlocks)
{
bb.SpanningTreeIndex = -1;
}
if(m_variables != null)
{
foreach(VariableExpression var in m_variables)
{
var.SpanningTreeIndex = -1;
}
}
//--//
m_ancestors = null;
m_variablesByStorage = null;
m_variablesByAggregate = null;
DataFlow.ControlTree.SpanningTree.Compute( cfg, out m_basicBlocks, out m_operators, out m_variables );
#if DEBUG
foreach(Operator op in m_operators)
{
CHECKS.ASSERT( op.BasicBlock.Owner == cfg, "Operator {0} does not belong to {1}", op, cfg.m_md );
}
#endif
//--//
//
// If any basic block got removed from the flow graph, it will become unreachable.
// Detect that and recompute the flow information.
//
bool fUpdateFlowInformation = false;
foreach(Operator op in m_operators)
{
PhiOperator phiOp = op as PhiOperator;
if(phiOp != null)
{
fUpdateFlowInformation |= phiOp.AdjustLinkage();
}
}
foreach(BasicBlock bb in cfg.m_basicBlocks)
{
if(bb.SpanningTreeIndex == -1)
{
CHECKS.ASSERT( ArrayUtility.FindReferenceInNotNullArray( m_basicBlocks, bb ) == -1, "{0} belongs in the spanning tree for {1} without an index", bb, cfg );
bb.Delete();
fUpdateFlowInformation = true;
}
}
cfg.m_basicBlocks = m_basicBlocks;
if(!fUpdateFlowInformation) break;
}
}
}
}
//
// Constructor Methods
//
//--//
//
// Helper Methods
//
private static VariableExpression[][] BuildStorageTable( VariableExpression[] variables )
{
int varNum = variables.Length;
VariableExpression[][] variablesByStorage = new VariableExpression[varNum][];
for(int varIdx = 0; varIdx < varNum; varIdx++)
{
if(variablesByStorage[varIdx] == null)
{
VariableExpression var = variables[varIdx];
if(var.AliasedVariable is LowLevelVariableExpression)
{
VariableExpression[] array = VariableExpression.SharedEmptyArray;
//
// We only need to scan forward.
// If we got here, it was because we didn't encounter an equivalent storage before this point.
//
for(int varIdx2 = varIdx; varIdx2 < varNum; varIdx2++)
{
VariableExpression var2 = variables[varIdx2];
if(var2 != null && var.IsTheSamePhysicalEntity( var2 ))
{
array = ArrayUtility.AppendToNotNullArray( array, var2 );
}
}
//
// Propagate the table to all the variables mapped to the same storage.
//
foreach(VariableExpression var3 in array)
{
variablesByStorage[var3.SpanningTreeIndex] = array;
}
}
else
{
variablesByStorage[varIdx] = new VariableExpression[] { var };
}
}
}
return variablesByStorage;
}
private static VariableExpression[][] BuildAggregationTable( VariableExpression[] variables )
{
int varNum = variables.Length;
VariableExpression[][] variablesByAggregate = new VariableExpression[varNum][];
for(int varIdx = 0; varIdx < varNum; varIdx++)
{
if(variablesByAggregate[varIdx] == null)
{
VariableExpression var = variables[varIdx];
VariableExpression[] array = VariableExpression.SharedEmptyArray;
//
// We only need to scan forward.
// If we got here, it was because we didn't encounter an equivalent storage before this point.
//
for(int varIdx2 = varIdx; varIdx2 < varNum; varIdx2++)
{
VariableExpression var2 = variables[varIdx2];
if(var2 != null && var.IsTheSameAggregate( var2 ))
{
array = ArrayUtility.AppendToNotNullArray( array, var2 );
}
}
//
// Propagate the table to all the variables mapped to the same storage.
//
foreach(VariableExpression var3 in array)
{
variablesByAggregate[var3.SpanningTreeIndex] = array;
}
}
}
return variablesByAggregate;
}
//--//
public IDisposable LockSpanningTree()
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
ci.Lock();
return ci;
}
//--//
public OperatorEnumeratorProvider< T > FilterOperators< T >() where T : Operator
{
return new OperatorEnumeratorProvider< T >( this.DataFlow_SpanningTree_Operators );
}
public struct OperatorEnumeratorProvider< T > where T : Operator
{
//
// State
//
private readonly Operator[] m_values;
//
// Constructor Methods
//
internal OperatorEnumeratorProvider( Operator[] values )
{
m_values = values;
}
//
// Helper Methods
//
public OperatorEnumerator< T > GetEnumerator()
{
return new OperatorEnumerator< T >( m_values );
}
}
public struct OperatorEnumerator< T > where T : Operator
{
//
// State
//
private readonly Operator[] m_values;
private T m_current;
private int m_index;
//
// Constructor Methods
//
internal OperatorEnumerator( Operator[] values )
{
m_values = values;
m_current = null;
m_index = 0;
}
//
// Helper Methods
//
public void Dispose()
{
}
public bool MoveNext()
{
while(m_index < m_values.Length)
{
T res = m_values[m_index++] as T;
if(res != null)
{
if(res.BasicBlock != null) // Skip deleted operators.
{
m_current = res;
return true;
}
}
}
m_current = null;
return false;
}
public T Current
{
get
{
return m_current;
}
}
}
//
// Access Methods
//
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BasicBlock[] DataFlow_SpanningTree_BasicBlocks
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
return ci.m_basicBlocks;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public BasicBlock[] DataFlow_SpanningTree_Ancestors
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
if(ci.m_ancestors == null)
{
ci.m_ancestors = DataFlow.ControlTree.SpanningTree.ComputeAncestors( ci.m_basicBlocks );
}
return ci.m_ancestors;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public Operator[] DataFlow_SpanningTree_Operators
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
return ci.m_operators;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public VariableExpression[] DataFlow_SpanningTree_Variables
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
return ci.m_variables;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public VariableExpression[][] DataFlow_SpanningTree_VariablesByStorage // It's indexed as VariableExpression[][]
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
if(ci.m_variablesByStorage == null)
{
ci.m_variablesByStorage = BuildStorageTable( ci.m_variables );
}
return ci.m_variablesByStorage;
}
}
[System.Diagnostics.DebuggerBrowsable( System.Diagnostics.DebuggerBrowsableState.Never )]
public VariableExpression[][] DataFlow_SpanningTree_VariablesByAggregate // It's indexed as VariableExpression[][]
{
get
{
var ci = GetCachedInfo< CacheInfo_SpanningTree >();
if(ci.m_variablesByAggregate == null)
{
ci.m_variablesByAggregate = BuildAggregationTable( ci.m_variables );
}
return ci.m_variablesByAggregate;
}
}
}
}
================================================
FILE: Zelig/Zelig/CompileTime/CodeGenerator/CodeTransformation/ControlFlowGraphState/ControlFlowGraphStateForCodeTransformation_Trace.cs
================================================
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//#define TRACE_EVERY_IR_CHANGE
//#define TRACE_EVERY_SINGLE_IR_CHANGE
namespace Microsoft.Zelig.CodeGeneration.IR
{
using System;
using System.Collections.Generic;
using Microsoft.Zelig.Runtime.TypeSystem;
public partial class ControlFlowGraphStateForCodeTransformation : ControlFlowGraphState
{
//
// Debug Methods
//
public void Dump()
{
using(var ird = new IR.TextIntermediateRepresentationDumper())
{
ird.WriteLine( "#################################################################################" );
ird.WriteLine( "#################################################################################" );
ird.WriteLine( "#################################################################################" );
this.Dump( ird );
}
}
public void DumpToFile( string file )
{
using(var ird = new IR.TextIntermediateRepresentationDumper( file ))
{
ird.WriteLine( "Method: {0}", this.m_md );
ird.WriteLine( );
this.Dump( ird );
}
}
public void DumpToStream( System.IO.StreamWriter output )
{
using(var ird = new IR.TextIntermediateRepresentationDumper( output ))
{
ird.WriteLine( "Method: {0}", this.m_md );
ird.WriteLine( );
this.Dump( ird );
ird.WriteLine();
}
}
#if TRACE_EVERY_IR_CHANGE
static int s_count;
static int s_dumpCount;
static int s_lastCount;
static string s_lastNote = "InitialState";
static byte[] s_lastDump;
static string s_directory;
static string s_phase = "InitialPhase";
static int s_phase_count;
internal static void SetPhaseForTrace( CompilationSteps.PhaseDriver driver )
{
s_phase = string.Format( "{0:X4}_{1}", ++s_phase_count, driver.GetType().Name );
}
internal void TraceToFile( Delegate dlg )
{
TraceToFile( dlg.Method.Name );
}
internal void TraceToFile( string note )
{
const string constText =
//// "FlowGraph(int[] Microsoft.NohauLPC3180Loader.Loader::TestArrayBoundChecks(int[],int,int))";
//// "FlowGraph(void Microsoft.Zelig.Runtime.MemorySegment::Initialize())";
//// "FlowGraph(void System.Array::Copy(System.Array,System.Array,int))";
//// "FlowGraph(void Microsoft.Zelig.Runtime.MarkAndSweepCollector::InitializeGarbageCollectionManager())";
//// "FlowGraph(int Microsoft.Zelig.Runtime.Helpers.BinaryOperations::IntDiv(int,int))";
//// "FlowGraph(int[] Microsoft.NohauLPC3180Loader.Loader::TestArrayBoundChecks(int[],int,int))";
//// "FlowGraph(uint Microsoft.NohauLPC3180Loader.Loader::Sqrt(uint))";
//// "FlowGraph(void System.Collections.Generic.ArraySortHelper`1::QuickSort