mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-26 14:28:30 +00:00
Restore missing cosmopolitan documentation on website
This commit is contained in:
parent
58352df0a4
commit
d9d5f45e2d
36 changed files with 715 additions and 228 deletions
27
third_party/chibicc/codegen.c
vendored
27
third_party/chibicc/codegen.c
vendored
|
@ -1152,19 +1152,6 @@ static int GetSseIntSuffix(Type *ty) {
|
|||
}
|
||||
}
|
||||
|
||||
static bool IsOverflowArithmetic(Node *node) {
|
||||
return (node->kind == ND_ADD || node->kind == ND_SUB ||
|
||||
node->kind == ND_MUL || node->kind == ND_NEG) &&
|
||||
node->overflow;
|
||||
}
|
||||
|
||||
static void HandleOverflow(const char *ax) {
|
||||
pop("%rdi");
|
||||
println("\tmov\t%s,(%%rdi)", ax);
|
||||
emitlin("\tseto\t%al");
|
||||
emitlin("\tmovzbl\t%al,%eax");
|
||||
}
|
||||
|
||||
static void HandleAtomicArithmetic(Node *node, const char *op) {
|
||||
gen_expr(node->lhs);
|
||||
push();
|
||||
|
@ -1238,10 +1225,6 @@ void gen_expr(Node *node) {
|
|||
}
|
||||
}
|
||||
case ND_NEG:
|
||||
if (IsOverflowArithmetic(node)) {
|
||||
gen_expr(node->overflow);
|
||||
push();
|
||||
}
|
||||
gen_expr(node->lhs);
|
||||
switch (node->ty->kind) {
|
||||
case TY_FLOAT:
|
||||
|
@ -1277,9 +1260,6 @@ void gen_expr(Node *node) {
|
|||
ax = "%eax";
|
||||
}
|
||||
println("\tneg\t%s", ax);
|
||||
if (IsOverflowArithmetic(node)) {
|
||||
HandleOverflow(ax);
|
||||
}
|
||||
return;
|
||||
case ND_VAR:
|
||||
gen_addr(node);
|
||||
|
@ -1771,10 +1751,6 @@ void gen_expr(Node *node) {
|
|||
error_tok(node->tok, "invalid expression");
|
||||
}
|
||||
}
|
||||
if (IsOverflowArithmetic(node)) {
|
||||
gen_expr(node->overflow);
|
||||
push();
|
||||
}
|
||||
if (node->lhs->ty->vector_size == 16) {
|
||||
gen_expr(node->rhs);
|
||||
pushx();
|
||||
|
@ -2210,9 +2186,6 @@ void gen_expr(Node *node) {
|
|||
default:
|
||||
error_tok(node->tok, "invalid expression");
|
||||
}
|
||||
if (IsOverflowArithmetic(node)) {
|
||||
HandleOverflow(ax);
|
||||
}
|
||||
}
|
||||
|
||||
void gen_stmt(Node *node) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue