mirror of https://gitlab.com/camelot/kickc.git
- Optimized namespace prefix logic for global variables and fixed but to also include exported global variables used in logic.
- Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in AsmLibrary.java. - Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in Pass4CodeGeneration.java. - Optimized naming of asmLibrary labels and names. Labels are to be used in assembler generation only. Names are used for all other purposes.
This commit is contained in:
parent
1a53d6a913
commit
20f3529a2d
|
@ -325,12 +325,16 @@ public class AsmFormat {
|
|||
// Implicit reference to imported .asm library procedure.
|
||||
String namespace = ((Procedure)symbol).getAsmLibraryLabel();
|
||||
if (namespace != null)
|
||||
asmName = namespace + "." + asmName;
|
||||
return namespace + "." + asmName;
|
||||
} else if(symbol instanceof Variable var) {
|
||||
// Implicit reference to imported global .asm library variable.
|
||||
String namespace = ((Variable)symbol).getImportAsmLibrary();
|
||||
if(namespace != null)
|
||||
asmName = namespace + "." + asmName;
|
||||
// Reference to imported global .asm library variable.
|
||||
String importLibraryName = ((Variable)symbol).getImportAsmLibraryLabel();
|
||||
if(importLibraryName != null)
|
||||
return importLibraryName + "." + asmName;
|
||||
// Reference to exported global .asm library variable.
|
||||
String exportLibraryName = ((Variable)symbol).getExportAsmLibraryLabel();
|
||||
if(exportLibraryName != null)
|
||||
return exportLibraryName + "." + asmName;
|
||||
}
|
||||
return asmFix(asmName);
|
||||
}
|
||||
|
|
|
@ -244,11 +244,11 @@ public class AsmLibrary extends AsmLine {
|
|||
else return false;
|
||||
}
|
||||
|
||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibrary) {
|
||||
String varExportAsmLibrary = constantVar.getExportAsmLibrary();
|
||||
if(exportAsmLibrary != null) {
|
||||
if(varExportAsmLibrary != null) {
|
||||
return constantVar.getExportAsmLibrary().equals(exportAsmLibrary);
|
||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibraryName) {
|
||||
if(exportAsmLibraryName != null) {
|
||||
String varExportAsmLibraryName = constantVar.getExportAsmLibraryName();
|
||||
if(varExportAsmLibraryName != null) {
|
||||
return varExportAsmLibraryName.equals(exportAsmLibraryName);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class Variable implements Symbol {
|
|||
constVar.setExport(variable.isExport());
|
||||
constVar.setComments(variable.getComments());
|
||||
constVar.setStructUnwind(variable.isStructUnwind());
|
||||
constVar.setAsmImportLibrary(variable.getImportAsmLibrary());
|
||||
constVar.setAsmImportLibrary(variable.getImportAsmLibraryName());
|
||||
// constVar.setAsmExportLibrary(variable.getExportAsmLibrary());
|
||||
return constVar;
|
||||
}
|
||||
|
@ -336,14 +336,23 @@ public class Variable implements Symbol {
|
|||
return this.asmImportLibrary != null;
|
||||
}
|
||||
|
||||
public String getExportAsmLibrary() {
|
||||
public String getExportAsmLibraryName() {
|
||||
return asmExportLibrary != null ? asmExportLibrary.toString() : null;
|
||||
}
|
||||
|
||||
public String getImportAsmLibrary() {
|
||||
public String getExportAsmLibraryLabel() {
|
||||
return asmExportLibrary != null ? asmExportLibrary.getAsm() : null;
|
||||
}
|
||||
|
||||
public String getImportAsmLibraryName() {
|
||||
return asmImportLibrary != null ? asmImportLibrary.toString() : null;
|
||||
}
|
||||
|
||||
public String getImportAsmLibraryLabel() {
|
||||
return asmImportLibrary != null ? asmImportLibrary.getAsm() : null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isKindIntermediate() {
|
||||
return Kind.INTERMEDIATE.equals(getKind());
|
||||
}
|
||||
|
|
|
@ -395,11 +395,11 @@ public class Pass4CodeGeneration {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibrary) {
|
||||
String varExportAsmLibrary = constantVar.getExportAsmLibrary();
|
||||
if(exportAsmLibrary != null) {
|
||||
if(varExportAsmLibrary != null) {
|
||||
return varExportAsmLibrary.equals(exportAsmLibrary);
|
||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibraryName) {
|
||||
String varExportAsmLibraryName = constantVar.getExportAsmLibraryName();
|
||||
if(exportAsmLibraryName != null) {
|
||||
if(varExportAsmLibraryName != null) {
|
||||
return varExportAsmLibraryName.equals(exportAsmLibraryName);
|
||||
} else {
|
||||
return true; // Bugfix
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ public class Pass4CodeGeneration {
|
|||
boolean isImportAsmLibraryGlobal = constantVar.isAsmImportLibraryGlobal();
|
||||
boolean isExportAsmLibraryParameter = constantVar.isAsmExportLibraryParameter();
|
||||
boolean isExportAsmLibraryReturn = constantVar.isAsmExportLibraryReturn();
|
||||
return ( varExportAsmLibrary == null || isExportAsmLibraryParameter || isExportAsmLibraryReturn )
|
||||
return ( varExportAsmLibraryName == null || isExportAsmLibraryParameter || isExportAsmLibraryReturn )
|
||||
&& !isImportAsmLibraryGlobal;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue