Created
July 30, 2011 05:41
-
-
Save jeremytregunna/1115240 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LLVMTypeRef obj_llvm_type(void) | |
| { | |
| LLVMTypeRef slotsType = LLVMPointerType(sarray_llvm_type(), 0); | |
| LLVMTypeRef pType = LLVMPointerType(LLVMVoidType(), 0); | |
| LLVMTypeRef cenvType = LLVMPointerType(cenv_llvm_type(), 0); | |
| LLVMTypeRef elementTypes[] = { slotsType, pTy, cenvType }; | |
| LLVMTypeRef structType = LLVMStructType(elementTypes, sizeof(elementTypes), 0); | |
| return structType; | |
| } | |
| obj_t* obj_add_func(obj_t* self, const char* name, LLVMTypeRef* params, unsigned param_count, LLVMTypeRef ret_type) | |
| { | |
| LLVMValueRef func = LLVMAddFunction(self->env->module, name, LLVMFunctionType(ret_type, params, param_count, 0)); | |
| LLVMSetFunctionCallConv(func, LLVMCCallConv); | |
| uint32_t sel = 0; // TODO: Get a hash of the name and the param types | |
| obj_install_slot(self, sel, func); | |
| return func; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment