No asm labels for X#

This commit is contained in:
kudzu_cp 2011-07-18 01:25:43 +00:00
parent 812603b385
commit bcfd0dd94f
3 changed files with 21 additions and 18 deletions

View file

@ -14,8 +14,8 @@ using System.Xml;
namespace Cosmos.Compiler.Assembler {
public abstract class Assembler {
public virtual void Initialize() {
}
public virtual void Initialize() { }
// Contains info on the current stack structure. What type are on the stack, etc
public readonly StackContents Stack = new StackContents();
@ -23,6 +23,8 @@ namespace Cosmos.Compiler.Assembler {
// as it will also cause problems when we thread the compiler
private static Assembler mCurrentInstance;
public bool EmitAsmLabels { get; set; }
protected int mCurrentMethodID;
public int CurrentMethodID {
get { return mCurrentMethodID; }
@ -45,7 +47,7 @@ namespace Cosmos.Compiler.Assembler {
protected internal List<Instruction> mInstructions = new List<Instruction>();
private List<DataMember> mDataMembers = new List<DataMember>();
public List<DataMember> DataMembers {
get { return mDataMembers; }
}
@ -101,20 +103,22 @@ namespace Cosmos.Compiler.Assembler {
return null;
}
public void Add(Instruction aReader){
if (aReader is Label || aReader is Comment) {
} else {
// Only issue label if its executable code.
// Also above if statement will prevent this new label
// from causing a stack overflow
new Label("." + AsmIlIdx.ToString("X2"));
mAsmIlIdx++;
public void Add(Instruction aReader) {
if (aReader is Label || aReader is Comment) {
} else {
if (EmitAsmLabels) {
// Only issue label if its executable code.
// Also above if statement will prevent this new label
// from causing a stack overflow
new Label("." + AsmIlIdx.ToString("X2"));
mAsmIlIdx++;
}
}
mInstructions.Add(aReader);
}
mInstructions.Add(aReader);
}
public void Add(params Instruction[] aReaders) {
mInstructions.Capacity += aReaders.Length;
mInstructions.Capacity += aReaders.Length;
foreach (Instruction xInstruction in aReaders) {
mInstructions.Add(xInstruction);
}

View file

@ -51,10 +51,7 @@ namespace Cosmos.Compiler.XSharp {
SetDataMembers(xBlock);
// Issue label for the routine
// TODO: Instead of issuing IL label, allow ASM option to turn
// off ASM labeling.
mAsm.CurrentIlLabel = CodeBlock.MakeLabel(xType);
xBlock.Label = mAsm.CurrentIlLabel;
xBlock.Label = CodeBlock.MakeLabel(xType);
if (xPreserveStack) {
xBlock.PushAll();

View file

@ -264,6 +264,8 @@ namespace Cosmos.IL2CPU.X86 {
new Label("DebugStub_Step");
new Return();
}
// Start emitting assembly labels
Assembler.CurrentInstance.EmitAsmLabels = true;
#if !LFB_1024_8
DataMembers.Add(new DataIfNotDefined("ELF_COMPILATION"));