mirror of https://github.com/aamine/cbc
add preproc tags.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4244 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
4d889a2588
commit
2871c6d19d
|
|
@ -90,9 +90,11 @@ class IRGenerator implements ASTVisitor<Void, Expr> {
|
|||
}
|
||||
// #@@}
|
||||
|
||||
// #@@range/assign{
|
||||
private void assign(Location loc, Expr lhs, Expr rhs) {
|
||||
stmts.add(new Assign(loc, addressOf(lhs), rhs));
|
||||
}
|
||||
// #@@}
|
||||
|
||||
private DefinedVariable tmpVar(Type t) {
|
||||
return scopeStack.getLast().allocateTmp(t);
|
||||
|
|
@ -692,7 +694,9 @@ class IRGenerator implements ASTVisitor<Void, Expr> {
|
|||
Expr expr = addressOf(transformExpr(node.expr()));
|
||||
Expr offset = ptrdiff(node.offset());
|
||||
Expr addr = new Bin(ptr_t(), Op.ADD, expr, offset);
|
||||
// #@@range/Member_ret{
|
||||
return node.isLoadable() ? mem(addr, node.type()) : addr;
|
||||
// #@@}
|
||||
}
|
||||
// #@@}
|
||||
|
||||
|
|
@ -801,9 +805,11 @@ class IRGenerator implements ASTVisitor<Void, Expr> {
|
|||
}
|
||||
|
||||
// mem(expr) -> (Mem expr)
|
||||
// #@@range/mem{
|
||||
private Mem mem(Expr expr, Type t) {
|
||||
return new Mem(asmType(t), expr);
|
||||
}
|
||||
// #@@}
|
||||
|
||||
// #@@range/ptrdiff{
|
||||
private Int ptrdiff(long n) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue