diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 16:30:01 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 16:30:01 -0500 |
| commit | 9b17c0ff7fa7a3981697f4239afb5c66c609cd42 (patch) | |
| tree | 96c2ae36609632900b8342387b181cecec31a6e1 /src/codegen.cpp | |
| parent | 3429639e848a9ffa9ff9fbd940d3fc2d348e10e7 (diff) | |
| download | zig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.tar.gz zig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.zip | |
IR: implement intType builtin
and int type field access
and fix compile time bool not
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 0642fbd7ec..06f9b295b9 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1230,11 +1230,6 @@ static LLVMValueRef ir_render_un_op(CodeGen *g, IrExecutable *executable, IrInst zig_unreachable(); } } - case IrUnOpBoolNot: - { - LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(expr)); - return LLVMBuildICmp(g->builder, LLVMIntEQ, expr, zero, ""); - } case IrUnOpBinNot: return LLVMBuildNot(g->builder, expr, ""); case IrUnOpAddressOf: @@ -1339,6 +1334,12 @@ static LLVMValueRef ir_render_un_op(CodeGen *g, IrExecutable *executable, IrInst zig_unreachable(); } +static LLVMValueRef ir_render_bool_not(CodeGen *g, IrExecutable *executable, IrInstructionBoolNot *instruction) { + LLVMValueRef value = ir_llvm_value(g, instruction->value); + LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(value)); + return LLVMBuildICmp(g->builder, LLVMIntEQ, value, zero, ""); +} + static LLVMValueRef ir_render_decl_var(CodeGen *g, IrExecutable *executable, IrInstructionDeclVar *decl_var_instruction) { @@ -1927,6 +1928,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, case IrInstructionIdCDefine: case IrInstructionIdCUndef: case IrInstructionIdEmbedFile: + case IrInstructionIdIntType: zig_unreachable(); case IrInstructionIdReturn: return ir_render_return(g, executable, (IrInstructionReturn *)instruction); @@ -1984,6 +1986,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, return ir_render_div_exact(g, executable, (IrInstructionDivExact *)instruction); case IrInstructionIdTruncate: return ir_render_truncate(g, executable, (IrInstructionTruncate *)instruction); + case IrInstructionIdBoolNot: + return ir_render_bool_not(g, executable, (IrInstructionBoolNot *)instruction); case IrInstructionIdSwitchVar: case IrInstructionIdContainerInitList: case IrInstructionIdStructInit: |
