remove the depends_on_compile_var code

cleanup from the decision in commit 8a859afd58
to remove "unnecessary if statement" error
This commit is contained in:
Andrew Kelley 2017-02-09 12:43:08 -05:00
parent fc100d7b3b
commit 92ffcc84a9
4 changed files with 137 additions and 281 deletions

View File

@ -149,7 +149,6 @@ enum RuntimeHintMaybe {
struct ConstExprValue {
TypeTableEntry *type;
ConstValSpecial special;
bool depends_on_compile_var;
LLVMValueRef llvm_value;
LLVMValueRef llvm_global;
@ -976,7 +975,6 @@ struct TypeTableEntry {
ZigLLVMDIType *di_type;
bool zero_bits;
bool size_depends_on_compile_var;
union {
TypeTableEntryPointer pointer;

View File

@ -1146,9 +1146,6 @@ static void resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) {
continue;
}
enum_type->size_depends_on_compile_var = enum_type->size_depends_on_compile_var ||
field_type->size_depends_on_compile_var;
if (!type_has_bits(field_type))
continue;
@ -1320,9 +1317,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
continue;
}
struct_type->size_depends_on_compile_var = struct_type->size_depends_on_compile_var ||
field_type->size_depends_on_compile_var;
if (!type_has_bits(field_type))
continue;
@ -3348,17 +3342,6 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
zig_unreachable();
}
static bool int_type_depends_on_compile_var(CodeGen *g, TypeTableEntry *int_type) {
assert(int_type->id == TypeTableEntryIdInt);
for (size_t i = 0; i < CIntTypeCount; i += 1) {
if (int_type == g->builtin_types.entry_c_int[i]) {
return true;
}
}
return false;
}
static uint64_t max_unsigned_val(TypeTableEntry *type_entry) {
assert(type_entry->id == TypeTableEntryIdInt);
if (type_entry->data.integral.bit_count == 64) {
@ -3407,7 +3390,6 @@ static int64_t min_signed_val(TypeTableEntry *type_entry) {
void eval_min_max_value(CodeGen *g, TypeTableEntry *type_entry, ConstExprValue *const_val, bool is_max) {
if (type_entry->id == TypeTableEntryIdInt) {
const_val->special = ConstValSpecialStatic;
const_val->depends_on_compile_var = int_type_depends_on_compile_var(g, type_entry);
if (is_max) {
if (type_entry->data.integral.is_signed) {
int64_t val = max_signed_val(type_entry);

View File

@ -3362,7 +3362,6 @@ static void define_builtin_types(CodeGen *g) {
bool is_signed = info->is_signed;
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt);
entry->size_depends_on_compile_var = true;
entry->type_ref = LLVMIntType(size_in_bits);
buf_init_from_str(&entry->name, info->name);
@ -3399,7 +3398,6 @@ static void define_builtin_types(CodeGen *g) {
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt);
entry->type_ref = LLVMIntType(g->pointer_size_bytes * 8);
entry->size_depends_on_compile_var = true;
const char u_or_i = is_signed ? 'i' : 'u';
buf_resize(&entry->name, 0);
@ -3455,7 +3453,6 @@ static void define_builtin_types(CodeGen *g) {
{
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdFloat);
entry->type_ref = LLVMX86FP80Type();
entry->size_depends_on_compile_var = true;
buf_init_from_str(&entry->name, "c_long_double");
entry->data.floating.bit_count = 80;

File diff suppressed because it is too large Load Diff