mirror of https://github.com/aamine/cbc
for ubuntu 64bit
This commit is contained in:
parent
f339ad28bc
commit
c01e3ff69b
|
|
@ -11,9 +11,9 @@ AR_CREATE = ar crs
|
|||
.SUFFIXES: .cb .s .o
|
||||
|
||||
.cb.o:
|
||||
$(CBC) $(CBFLAGS) -c $< -o $@
|
||||
$(CBC) $(CBFLAGS) -Wa,"--32" -c $< -o $@
|
||||
.s.o:
|
||||
$(CBC) -c $<
|
||||
$(CBC) -Wa,"--32" -c $<
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR_CREATE) $(TARGET) $(OBJS)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TypeChecker extends Visitor {
|
|||
}
|
||||
|
||||
private void checkParamTypes(DefinedFunction f) {
|
||||
for (Parameter param : f.parameters()) {
|
||||
for (CBCParameter param : f.parameters()) {
|
||||
if (isInvalidParameterType(param.type())) {
|
||||
error(param.location(),
|
||||
"invalid parameter type: " + param.type());
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class TypeResolver extends Visitor
|
|||
// #@@range/resolveFunctionHeader{
|
||||
private void resolveFunctionHeader(Function func) {
|
||||
bindType(func.typeNode());
|
||||
for (Parameter param : func.parameters()) {
|
||||
for (CBCParameter param : func.parameters()) {
|
||||
// arrays must be converted to pointers in a function parameter.
|
||||
Type t = typeTable.getParamType(param.typeNode().typeRef());
|
||||
param.typeNode().setType(t);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package net.loveruby.cflat.entity;
|
||||
import net.loveruby.cflat.ast.TypeNode;
|
||||
|
||||
public class Parameter extends DefinedVariable {
|
||||
public Parameter(TypeNode type, String name) {
|
||||
public class CBCParameter extends DefinedVariable {
|
||||
public CBCParameter(TypeNode type, String name) {
|
||||
super(false, type, name, null);
|
||||
}
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ public class DefinedFunction extends Function {
|
|||
return true;
|
||||
}
|
||||
|
||||
public List<Parameter> parameters() {
|
||||
public List<CBCParameter> parameters() {
|
||||
return params.parameters();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ abstract public class Function extends Entity {
|
|||
public boolean isInitialized() { return true; }
|
||||
|
||||
abstract public boolean isDefined();
|
||||
abstract public List<Parameter> parameters();
|
||||
abstract public List<CBCParameter> parameters();
|
||||
|
||||
public Type returnType() {
|
||||
return type().getFunctionType().returnType();
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ import net.loveruby.cflat.ast.Location;
|
|||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Params extends ParamSlots<Parameter>
|
||||
public class Params extends ParamSlots<CBCParameter>
|
||||
implements net.loveruby.cflat.ast.Dumpable {
|
||||
public Params(Location loc, List<Parameter> paramDescs) {
|
||||
public Params(Location loc, List<CBCParameter> paramDescs) {
|
||||
super(loc, paramDescs, false);
|
||||
}
|
||||
|
||||
public List<Parameter> parameters() {
|
||||
public List<CBCParameter> parameters() {
|
||||
return paramDescriptors;
|
||||
}
|
||||
|
||||
public ParamTypeRefs parametersTypeRef() {
|
||||
List<TypeRef> typerefs = new ArrayList<TypeRef>();
|
||||
for (Parameter param : paramDescriptors) {
|
||||
for (CBCParameter param : paramDescriptors) {
|
||||
typerefs.add(param.typeNode().typeRef());
|
||||
}
|
||||
return new ParamTypeRefs(location, typerefs, vararg);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class UndefinedFunction extends Function {
|
|||
this.params = params;
|
||||
}
|
||||
|
||||
public List<Parameter> parameters() {
|
||||
public List<CBCParameter> parameters() {
|
||||
return params.parameters();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ Params params():
|
|||
LOOKAHEAD(<VOID> ")")
|
||||
t=<VOID>
|
||||
{
|
||||
return new Params(location(t), new ArrayList<Parameter>());
|
||||
return new Params(location(t), new ArrayList<CBCParameter>());
|
||||
}
|
||||
| params=fixedparams()
|
||||
["," "..." { params.acceptVarargs(); }]
|
||||
|
|
@ -580,8 +580,8 @@ Params params():
|
|||
// #@@range/fixedparams{
|
||||
Params fixedparams():
|
||||
{
|
||||
List<Parameter> params = new ArrayList<Parameter>();
|
||||
Parameter param, param1;
|
||||
List<CBCParameter> params = new ArrayList<CBCParameter>();
|
||||
CBCParameter param, param1;
|
||||
}
|
||||
{
|
||||
param1=param() { params.add(param1); }
|
||||
|
|
@ -593,13 +593,13 @@ Params fixedparams():
|
|||
// #@@}
|
||||
|
||||
// #@@range/param{
|
||||
Parameter param():
|
||||
CBCParameter param():
|
||||
{
|
||||
TypeNode t;
|
||||
String n;
|
||||
}
|
||||
{
|
||||
t=type() n=name() { return new Parameter(t, n); }
|
||||
t=type() n=name() { return new CBCParameter(t, n); }
|
||||
}
|
||||
// #@@}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ class GNULinker implements Linker {
|
|||
// #@@range/vars{
|
||||
static final private String LINKER = "/usr/bin/ld";
|
||||
static final private String DYNAMIC_LINKER = "/lib/ld-linux.so.2";
|
||||
static final private String C_RUNTIME_INIT = "/usr/lib/crti.o";
|
||||
static final private String C_RUNTIME_START = "/usr/lib/crt1.o";
|
||||
static final private String C_RUNTIME_START_PIE = "/usr/lib/Scrt1.o";
|
||||
static final private String C_RUNTIME_FINI = "/usr/lib/crtn.o";
|
||||
static final private String C_RUNTIME_INIT = "/usr/lib32/crti.o";
|
||||
static final private String C_RUNTIME_START = "/usr/lib32/crt1.o";
|
||||
static final private String C_RUNTIME_START_PIE = "/usr/lib32/Scrt1.o";
|
||||
static final private String C_RUNTIME_FINI = "/usr/lib32/crtn.o";
|
||||
// #@@}
|
||||
|
||||
ErrorHandler errorHandler;
|
||||
|
|
|
|||
|
|
@ -567,9 +567,9 @@ public class CodeGenerator implements net.loveruby.cflat.sysdep.CodeGenerator,
|
|||
static final private long PARAM_START_WORD = 2;
|
||||
// return addr and saved bp
|
||||
|
||||
private void locateParameters(List<Parameter> params) {
|
||||
private void locateParameters(List<CBCParameter> params) {
|
||||
long numWords = PARAM_START_WORD;
|
||||
for (Parameter var : params) {
|
||||
for (CBCParameter var : params) {
|
||||
var.setMemref(mem(stackSizeFromWordNum(numWords), bp()));
|
||||
numWords++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue