Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-s168 committed Sep 25, 2024
1 parent 41b225c commit b9b8490
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ if [ -z $EMPATH ]; then
: ${CC:=clang}
: ${BUILD_CC:=$CC}
: ${EX_CFLAGS:=""}
: ${EX_LDFLAGS:=""}
: ${AR:="ar"}
else
: ${CC:=$EMPATH/emcc}
: ${BUILD_CC:=clang}
: ${EX_CFLAGS:="-O3"}
: ${EX_LDFLAGS:=""}
: ${AR:=$EMPATH/emar}
fi

Expand Down Expand Up @@ -59,7 +61,7 @@ function prepare() {
echo "# found python at: $python"
$python -m pip install generic-lexer &>/dev/null
echo "# pip generic-lexer installed"
$BUILD_CC build.c -lpthread -DVERBOSE=1 -DPYTHON="\"$python\"" -DCC="\"$CC\"" -DCC_ARGS="\"$CFLAGS\"" -DAR="\"$AR\"" -o build.exe
$BUILD_CC build.c -lpthread -DVERBOSE=1 -DPYTHON="\"$python\"" -DCC="\"$CC\"" -DCC_ARGS="\"$CFLAGS\"" -DLD_ARGS="\"$EX_LDFLAGS\"" -DAR="\"$AR\"" -o build.exe
echo "# build.exe compiled"
echo "# gen cdef files"
./build.exe gen
Expand Down Expand Up @@ -91,7 +93,7 @@ elif [[ $1 == "build" ]]; then
./build.exe lib.a
else
echo "invalid arguments; usage: ./build.sh [ganalyze|analyze|build]"
echo "you can set CC, CFLAGS, BUILD_CC, python, EX_CFLAGS, AR"
echo "you can set CC, CFLAGS, BUILD_CC, python, EX_CFLAGS, AR, EX_LDFLAGS"
echo "if you set EMPATH, these flags get added automatically (you can overwrite them manually): CC=\$EMPATH/emcc BUILD_CC=clang EX_CFLAGS="-O3" AR=\$EMPATH/emar"
fi

Expand Down
2 changes: 0 additions & 2 deletions cg/x86_stupid/cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,8 +1330,6 @@ vx_cg_x86stupid vx_cg_x86stupid_options = (vx_cg_x86stupid) {
};

void vx_cg_x86stupid_gen(vx_IrBlock* block, FILE* out) {
vx_IrBlock_dump(block, stdout, 0);

fprintf(out, "%s:\n", block->name);

assert(block->is_root);
Expand Down
2 changes: 1 addition & 1 deletion ir/opt/constant_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void vx_opt_constant_eval(vx_IrBlock *block)
vx_IrOp_removeParams(op); \
vx_IrOp_addParam_s(op, VX_IR_NAME_VALUE, (vx_IrValue) { \
.type = VX_IR_VAL_IMM_FLT, \
.imm_flt = ((typedest) a->imm_flt) + ((typedest) b->imm_flt) \
.imm_flt = ((typedest) a->imm_flt) what ((typedest) b->imm_flt) \
}); \
} \
}
Expand Down
2 changes: 1 addition & 1 deletion ir/opt/inline_vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static bool vx_IrView_substitute_var__trav(vx_IrOp *op, void *dataIn) {
}
}

if (op->id != VX_IR_OP_PLACE)
if (op->id != VX_IR_OP_PLACE && op->id != VX_IR_OP_RETURN)
for (size_t i = 0; i < op->params_len; i ++)
if (op->params[i].val.type == VX_IR_VAL_VAR && op->params[i].val.var == data->old)
op->params[i].val = data->new;
Expand Down
5 changes: 0 additions & 5 deletions ir/opt/ll_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ static void runSched(vx_IrBlock* block, struct Move **to_move, size_t *to_move_l
void vx_opt_ll_sched(vx_IrBlock *block) {
assert(block->is_root);

vx_IrBlock_dump(block, stdout, 0);

struct Move* to_move = NULL;
size_t to_move_len = 0;

Expand Down Expand Up @@ -87,7 +85,4 @@ void vx_opt_ll_sched(vx_IrBlock *block) {
}

free(to_move);

vx_IrBlock_dump(block, stdout, 0);

}
3 changes: 0 additions & 3 deletions ir/transform/ssair_llir_lower.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ static void into(vx_IrBlock *src, vx_IrOp *parent, vx_IrBlock *dest, size_t cont
}

static void lower_into(vx_IrBlock *old, vx_IrBlock *dest, vx_IrBlock *newParent, size_t continueLabel, size_t breakLabel, vx_IrOp* loopOP) {
// TODO: remove
vx_IrBlock_dump(old, stdout, 0);

for (vx_IrOp *op = old->first; op; op = op->next) {
op->parent = newParent;

Expand Down

0 comments on commit b9b8490

Please sign in to comment.