search for: mainfunc

Displaying 10 results from an estimated 10 matches for "mainfunc".

Did you mean: main_func
2016 Mar 14
4
LLVM 3.8 change in function argument lists?
Hi, I am upgrading my project from 3.7 to 3.8. I find that following code used to compile in 3.7 but doesn't in 3.8 and I can't understand why. llvm::Function *mainFunc = ...; auto argiter = mainFunc->arg_begin(); llvm::Value *arg1 = argiter++; arg1->setName("obj"); But if I change the code to following it compiles: auto argiter = mainFunc->arg_begin(); llvm::Value *arg1 = &(*argiter); arg1->setName("obj"); As far as I can t...
2005 Jun 07
5
Functions within functions in R and S-Plus
...nc" not found ". I have tried to keep most of the structure in my original problem (but simplified it!), so the code could seem a bit strange. I suspect that this has something to do with different scoping rules in R and S-Plus, but still I have not found a workable solution in S-Plus. mainfunc <- function(x){ est <- function(x,par){ abs(sum(par*x)) } func <- function(par,x){ est(x,par) } est.theta <- function(x){ optimize(func,lower=-10, upper=20,x=x)$minimum } est.theta(x) } x <- 1:10 mainfunc(x) Any help is greatly appreciated. Victor
2013 May 21
1
[LLVMdev] Is it valid to add parameters to a function once it is created
...<< "Staring new LLVM function ...\n"; Mod = new llvm::Module("module", llvm::getGlobalContext()); builder = new llvm::IRBuilder<>(llvm::getGlobalContext()); llvm::FunctionType *funcType = llvm::FunctionType::get(builder->getVoidTy(), false); mainFunc = llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, "main", Mod); llvm::BasicBlock* entry = llvm::BasicBlock::Create(llvm::getGlobalContext(), "entrypoint", mainFunc); builder->SetInsertPoint(entry); llvm_counters::param_counter = 0; ll...
2013 May 22
1
[LLVMdev] Best strategy to add a parameter to a function
...oat("arg1"); The function add_param_float should add a 'float' parameter to the function and return its value. Right now it's implemented like this Value* add_param_float() { return new llvm::Argument( llvm::Type::getFloatTy(llvm::getGlobalContext()) , param_next() , mainFunc ); } where param_next just figures some new, unused name for the argument and mainFunc is the function being built. This works to a certain extent. I am seeing issues with certain type printers and I assume the way the argument is added to the function is not a strictly valid thing to do. I gu...
2015 Mar 10
4
[LLVMdev] noob IR builder question
...xt()); 5 6 int main(int argc, const char * argv[]) { 7 llvm::LLVMContext & context = llvm::getGlobalContext(); 8 module = new llvm::Module("calc", context); 9 10 11 llvm::FunctionType *funcType = llvm::FunctionType::get(builder.getVoidTy(), false); 12 llvm::Function *mainFunc = 13 llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, "main", module); 14 llvm::BasicBlock *entry = llvm::BasicBlock::Create(context, "entrypoint", mainFunc); 15 builder.SetInsertPoint(entry); 16 17 llvm::Value *helloWorld = builder.CreateGlobalString...
2007 Jul 24
1
Passing equations as arguments
Friends, I'm trying to pass an equation as an argument to a function. The idea is as follows. Let us say i write an independent function Ideal Situation: ifunc <- function(x) { return((x*x)-2) } mainfunc <- function(a,b) { evala <- ifunc(a) evalb <- ifunc(b) if (evala>evalb){return(evala)} else return(evalb) } Now I want to try and write this entire program in a single function with the user specifying the equation as an argument to the function. myfunc <- function(a, b, eqn) {...
2012 Jan 23
1
[LLVMdev] Code crashing in CreateGlobalStringPtr, passes when I add code for main routine + entry
...{ llvm::LLVMContext & context = llvm::getGlobalContext(); llvm::Module *module = new llvm::Module("asdf", context); llvm::IRBuilder<> builder(context); // Added extra llvm::FunctionType *funcType = llvm::FunctionType::get(builder.getVoidTy(), false); llvm::Function *mainFunc = llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, "main", module); llvm::BasicBlock *entry = llvm::BasicBlock::Create(context, "entry", mainFunc); builder.SetInsertPoint(entry); llvm::Value *helloWorld = builder.CreateGlobalStringPtr("hello world!\n...
2019 Jul 08
2
Problem with the LLVM v8.0 IR 'select' instruction
...sample that shows the issue and the output that Clang 8.0.0 makes (using the binary release from llvm.org). I invoke clang as follows: clang -S -O3 -o Evergrowing.s -Wall Evergrowing.ll I tried using -O1, -O2, and -O3, but all where the same. Please notice that I renamed 'main()' to 'mainfunc()' to be sure Clang isn't picking up 'main()' as a reserved, special function. This on a Windows 10 x64 PC, but I got exactly the same behavior on arm7hf and aarch64. Cheers, Mikael Egevig Den man. 8. jul. 2019 kl. 04.30 skrev Mehdi AMINI <joker.eph at gmail.com>: > H...
2019 Jul 07
2
Problem with the LLVM v8.0 IR 'select' instruction
Hi guys, I am doing a hobby compiler using LLVM. I have a rather peculiar problem with the 'select' instruction, as far as I can see. Given this code: ************************************************ ; Run-time Library Definitions %Exception = type { i8 } define private %Exception* @Start(i1* %$result) #0 { prologue: store i1 true, i1* %$result br label %epilogue epilogue:
2014 Aug 02
2
[LLVMdev] LLVM Basic Program Compilation
Thank you Chris. I am using llvm-3.4.2. I am facing the same issue when using clang++ as well. $ clang++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS `llvm-config --cxxflags --ldflags --libs` -S -emit-llvm gives me errors $clang++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -S -emit-llvm $ lli try.s gives me Program used external function