Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Implement the rest of Binary and Unary Expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Jul 23, 2018
1 parent cca9a97 commit c14eaa3
Show file tree
Hide file tree
Showing 2 changed files with 259 additions and 93 deletions.
15 changes: 13 additions & 2 deletions src/llvm/CompilerIntrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import { llvmContext } from "./llvm-context.js";

export class Intrinsics {
+_module: Module;
_memcpy: ?LLVMFunction;
_memcmp: ?LLVMFunction;
_stringType: ?StructType;
_uint32Type: ?StructType;
_memcpy: ?LLVMFunction;
_memcmp: ?LLVMFunction;
_pow: ?LLVMFunction;

constructor(module: Module) {
this._module = module;
Expand Down Expand Up @@ -92,4 +93,14 @@ export class Intrinsics {
this._memcmp = memcmp;
return memcmp;
}

get pow(): LLVMFunction {
if (this._pow) return this._pow;
let returnType = LLVMType.getDoubleTy(llvmContext);
let args = [LLVMType.getDoubleTy(llvmContext), LLVMType.getDoubleTy(llvmContext)];
let fnType = FunctionType.get(returnType, args, false);
let pow = LLVMFunction.create(fnType, LinkageTypes.ExternalLinkage, "llvm.pow.f64", this._module);
this._pow = pow;
return pow;
}
}
Loading

0 comments on commit c14eaa3

Please sign in to comment.