mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 14:54:09 +02:00
Added bitcode emission, additional logging
This commit is contained in:
parent
1e8c633a36
commit
43b69023f6
14 changed files with 74 additions and 31 deletions
|
@ -21,7 +21,7 @@ namespace IDE.Compiler
|
|||
EmitLineInfo = 2,
|
||||
WriteIR = 4,
|
||||
GenerateOBJ = 8,
|
||||
NoFramePointerElim = 0x10,
|
||||
GenerateBitcode = 0x10,
|
||||
ClearLocalVars = 0x20,
|
||||
RuntimeChecks = 0x40,
|
||||
EmitDynamicCastCheck = 0x80,
|
||||
|
@ -32,7 +32,9 @@ namespace IDE.Compiler
|
|||
EnableSideStack = 0x1000,
|
||||
EnableHotSwapping = 0x2000,
|
||||
IncrementalBuild = 0x4000,
|
||||
DebugAlloc = 0x8000
|
||||
DebugAlloc = 0x8000,
|
||||
OmitDebugHelpers = 0x10000,
|
||||
NoFramePointerElim = 0x20000,
|
||||
}
|
||||
|
||||
[StdCall, CLink]
|
||||
|
@ -491,8 +493,10 @@ namespace IDE.Compiler
|
|||
}
|
||||
else
|
||||
{
|
||||
SetOpt((options.mIntermediateType == .IRCode) || (options.mIntermediateType == .ObjectAndIRCode), .WriteIR);
|
||||
SetOpt((options.mIntermediateType == .Object) || (options.mIntermediateType == .ObjectAndIRCode), .GenerateOBJ);
|
||||
SetOpt((options.mIntermediateType == .IRCode) || (options.mIntermediateType == .ObjectAndIRCode) || (options.mIntermediateType == .BitcodeAndIRCode), .WriteIR);
|
||||
SetOpt((options.mIntermediateType == .Object) || (options.mIntermediateType == .ObjectAndIRCode) ||
|
||||
(options.mIntermediateType == .Bitcode) || (options.mIntermediateType == .BitcodeAndIRCode), .GenerateOBJ);
|
||||
SetOpt((options.mIntermediateType == .Bitcode) || (options.mIntermediateType == .BitcodeAndIRCode), .GenerateBitcode);
|
||||
}
|
||||
SetOpt(options.mNoOmitFramePointers, .NoFramePointerElim);
|
||||
SetOpt(options.mInitLocalVariables, .ClearLocalVars);
|
||||
|
|
|
@ -158,10 +158,6 @@ namespace IDE.Compiler
|
|||
|
||||
public void SetSource(String data, String fileName)
|
||||
{
|
||||
if (fileName.Contains("main4.cs"))
|
||||
{
|
||||
}
|
||||
|
||||
Debug.Assert(!mIsUsed);
|
||||
mIsUsed = true;
|
||||
BfParser_SetSource(mNativeBfParser, data, (int32)data.Length, fileName);
|
||||
|
|
|
@ -79,6 +79,9 @@ namespace IDE.Compiler
|
|||
[StdCall, CLink]
|
||||
extern static void BfSystem_DbgPrintTimings();
|
||||
|
||||
[StdCall, CLink]
|
||||
extern static void BfSystem_Log(void* bfSystem, char8* str);
|
||||
|
||||
public void* mNativeBfSystem;
|
||||
public bool mIsTiming;
|
||||
public Monitor mMonitor = new Monitor() ~ delete _;
|
||||
|
@ -360,5 +363,10 @@ namespace IDE.Compiler
|
|||
AddTypeOptions(typeOption.mFilter, typeOption.mBfSIMDSetting, typeOption.mBfOptimizationLevel, typeOption.mEmitDebugInfo, typeOption.mRuntimeChecks,
|
||||
typeOption.mInitLocalVariables, typeOption.mEmitDynamicCastCheck, typeOption.mEmitObjectAccessCheck, typeOption.mAllocStackTraceDepth);
|
||||
}
|
||||
|
||||
public void Log(String str)
|
||||
{
|
||||
BfSystem_Log(mNativeBfSystem, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3775,6 +3775,8 @@ namespace IDE
|
|||
[IDECommand]
|
||||
void Compile()
|
||||
{
|
||||
CompilerLog("IDEApp.Compile");
|
||||
|
||||
if (AreTestsRunning())
|
||||
return;
|
||||
if (mHotResolveState != .None)
|
||||
|
@ -6500,6 +6502,16 @@ namespace IDE
|
|||
mOutputPanel.Write(outStr);
|
||||
}
|
||||
|
||||
public void CompilerLog(String format, params Object[] args)
|
||||
{
|
||||
var str = scope String();
|
||||
str..AppendF(format, params args);
|
||||
if (mBfBuildSystem != null)
|
||||
mBfBuildSystem.Log(str);
|
||||
if (mBfResolveSystem != null)
|
||||
mBfResolveSystem.Log(str);
|
||||
}
|
||||
|
||||
public void OutputLine(String format, params Object[] args)
|
||||
{
|
||||
String outStr;
|
||||
|
@ -8162,6 +8174,8 @@ namespace IDE
|
|||
|
||||
BfPassInstance CompileBeef(Project hotProject, int32 hotIdx, bool lastCompileHadMessages, out bool hadBeef)
|
||||
{
|
||||
CompilerLog("IDEApp.CompileBeef");
|
||||
|
||||
hadBeef = false;
|
||||
mCompilingBeef = true;
|
||||
BeefCompileStarted();
|
||||
|
@ -11484,6 +11498,8 @@ namespace IDE
|
|||
|
||||
public void OnWatchedFileChanged(ProjectItem projectItem, WatcherChangeTypes changeType, String newPath)
|
||||
{
|
||||
CompilerLog("IDEApp.OnWatchedFileChanged {} {} {}", projectItem.mName, changeType, newPath);
|
||||
|
||||
ProjectListViewItem listViewItem;
|
||||
mProjectPanel.mProjectToListViewMap.TryGetValue(projectItem, out listViewItem);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
@ -17,7 +18,9 @@ namespace IDE
|
|||
{
|
||||
Object,
|
||||
IRCode,
|
||||
ObjectAndIRCode
|
||||
ObjectAndIRCode,
|
||||
Bitcode,
|
||||
BitcodeAndIRCode,
|
||||
}
|
||||
|
||||
public enum PlatformType
|
||||
|
@ -748,7 +751,7 @@ namespace IDE
|
|||
options.mIncrementalBuild = !isRelease;
|
||||
|
||||
options.mAllocStackTraceDepth = 1;
|
||||
options.mIntermediateType = .Object;
|
||||
options.mIntermediateType = (platformType == .iOS) ? .Bitcode : .Object;
|
||||
options.mCSIMDSetting = .SSE2;
|
||||
options.mCOptimizationLevel = isRelease ? .O2 : .O0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue