* net/loveruby/cflat/ast/UndefinedVariable.java: should not append '$' for extern symbol address.

* import/stdio.hb: add va_list functions.
* import/stdarg.hb: new file.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4014 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2008-09-13 20:36:34 +00:00
parent b484f96864
commit b79d20d4c3
5 changed files with 28 additions and 6 deletions

View File

@ -1,3 +1,12 @@
Sun Sep 14 05:36:30 2008 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/ast/UndefinedVariable.java: should not append
'$' for extern symbol address.
* import/stdio.hb: add va_list functions.
* import/stdarg.hb: new file.
Sun Sep 14 02:27:56 2008 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/TypeChecker.java: reject incomplete

11
ToDo
View File

@ -2,8 +2,11 @@
== Current
* extern gvar access
* simple vararg retrieve (get vararg address)
* handle multiple arguments (source files, assembly files, object files)
* -l
* -L
* -Wl, -Xlinker
* va_list
* -Wa, -Xassembler
* -O (peephole optimization)
* movl $0, %eax => xorl %eax, %eax
@ -17,9 +20,6 @@
* imull $1, %eax => NONE
* label renaming
* remove useless jump
* -Wl, -Xlinker
* -l
* -L
* -fPIC (PIC generation)
* -shared
* remove all FIXME
@ -230,3 +230,4 @@
- sizeof
- calculate address on AX register.
- prohibit multi-dimension array without size
- extern gvar access

7
import/stdarg.hb Normal file
View File

@ -0,0 +1,7 @@
// stdarg.hb
typedef unsigned long va_arg_t;
typedef va_arg_t* va_list;
extern va_list va_init(void* arg);
extern void* va_next(va_list* ap);

View File

@ -2,6 +2,7 @@
// stdio.hb
import stddef; // for size_t
import stdarg;
typedef unsigned long FILE; // dummy
@ -36,3 +37,7 @@ extern int ferror(FILE* stream);
extern int fileno(FILE* stream);
extern void clearerr(FILE* stream);
extern void perror(char* param);
extern int vprintf(char* fmt, va_list ap);
extern int vfprintf(FILE* s, char* fmt, va_list ap);
extern int vsprintf(char *buf, char* fmt, va_list ap);
extern int vsnprintf(char *buf, size_t size, char* fmt, va_list ap);

View File

@ -20,7 +20,7 @@ public class UndefinedVariable extends Variable {
}
public AsmEntity address() {
return new Reference(symbol());
return new Label(symbol());
}
protected void _dump(Dumper d) {