Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] noob IR builder question"
2013 May 21
1
[LLVMdev] Is it valid to add parameters to a function once it is created
I create a function with an empty signature:
void llvm_start_new_function() {
llvm::outs() << "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);
2013 May 22
1
[LLVMdev] Best strategy to add a parameter to a function
I am trying to build a function (C++ Builder) and at the same time
extend its parameter set. Here's what I try to do:
Value* arg0 = add_param_float("arg0");
Value* tmp = builder->CreateFAdd(arg0,some_previous_value);
Value* arg1 = add_param_float("arg1");
The function add_param_float should add a 'float' parameter to the
function and return its value. Right
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
2008 Jun 09
7
[LLVMdev] regression? Or did I do something wrong again?
I don't know if the toy program in chapter 4 of the tutorial
implementing Kaleidoscope in llvm with C++ is part of your
regression suite, but with the version of llvm I installed
last weekend, it does not compile:
hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
toy.cpp: In member function ‘virtual llvm::Value*
2007 Sep 05
2
[LLVMdev] Seeing a crash with ConstantFP::get
Hola LLVMers,
I'm getting a crash when using ConstantFP::get.
I can repro it by adding one line to the Fibonacci example program:
int main(int argc, char **argv) {
int n = argc > 1 ? atol(argv[1]) : 24;
// Create some module to put our function into it.
Module *M = new Module("test");
// We are about to create the "fib" function:
Function
2007 Sep 05
2
[LLVMdev] Seeing a crash with ConstantFP::get
It's in debug. I'm having a look at the assembler it's producing right
now and it's definitely a little odd for what should be a simple
assignment in zeroSignificand.
________________________________
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Dale Johannesen
Sent: Wednesday, September 05, 2007 2:39 PM
To: LLVM Developers Mailing
2007 Sep 05
0
[LLVMdev] Seeing a crash with ConstantFP::get
On Sep 5, 2007, at 2:21 PM, Chuck Rose III wrote:
> Hola LLVMers,
>
>
>
> I’m getting a crash when using ConstantFP::get.
>
>
>
> I can repro it by adding one line to the Fibonacci example program:
>
>
>
> int main(int argc, char **argv) {
>
> int n = argc > 1 ? atol(argv[1]) : 24;
>
>
>
> // Create some module to put our function
2007 Sep 06
0
[LLVMdev] Seeing a crash with ConstantFP::get
Hola Dale,
I spent some time walking through what's going on with a friend of mine
from VStudio. Category is given 2 bits in the APFloat class definition.
It's sign extending the enum value for the comparisons when it loads it
out of the class, so the 2 becomes a -2 and the comparison fails. He
sent me a piece of code which I might be able to use to force the issue.
I'll update
2008 Jun 09
0
[LLVMdev] regression? Or did I do something wrong again?
Hi Hendrik,
> hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
> toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’:
> toy.cpp:359: error: no matching function for call to ‘llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)’
> /usr/local/llvm/include/llvm/Constants.h:237: note:
2019 Sep 26
2
ConstantFP->getType() is not right
Hi, I want to create a double constant from a float constant, here's my
code:
auto* constFloat1 =
static_cast<llvm::ConstantFP*>(llvm::ConstantFP::get(llvm::Type::getFloatTy(context),
3.1));
assert(constFloat1->getType() == llvm::Type::getFloatTy(context));
auto* constFloat2 =
llvm::ConstantFP::get(llvm::Type::getDoubleTy(context),
constFloat1->getValueAPF());
2008 Jun 09
0
[LLVMdev] regression? Or did I do something wrong again?
On Mon, Jun 9, 2008 at 7:29 AM, Hendrik Boom <hendrik at topoi.pooq.com> wrote:
> I don't know if the toy program in chapter 4 of the tutorial
> implementing Kaleidoscope in llvm with C++ is part of your
> regression suite
It isn't (although that might be a good idea).
> but with the version of llvm I installed
> last weekend, it does not compile:
>
> hendrik
2008 Jun 10
1
[LLVMdev] regression? Or did I do something wrong again?
On Mon, 09 Jun 2008 21:25:42 +0200, Matthijs Kooijman wrote:
> Hi Hendrik,
>
> It seems the ConstantFP method get might have been modified to take a
> reference-to-APFloat, meaning you can't pass in APFloat(Value) anonymously.
> You should either put it in a local variable, like
> APFloat F(Val);
> return ConstantFP::get(Type::DoubleTy, F);
> which I _think_ is the
2015 Jan 14
2
[LLVMdev] Bug in InsertElement constant propagation?
Hi,
When I run opt on the following LLVM IR:
define i32 @foo() {
bb0:
%0 = bitcast i32 2139171423 to float
%1 = insertelement <1 x float> undef, float %0, i32 0
%2 = extractelement <1 x float> %1, i32 0
%3 = bitcast float %2 to i32
ret i32 %3
}
->
It generates:
define i32 @foo() {
bb0:
ret i32 2143365727
}
While tracking the value I see that the floating point value
2008 Apr 20
1
[LLVMdev] ConstantFP API Change
Hi All,
At some point in the next week or two I'm going to remove the
ConstantFP::get(type, APFloat) method. Right now, you can immediately
fix your code by dropping the first 'type' argument. For example, if
you have:
ConstantFP::get(Ty, APFloat(1.0))
just change it to:
ConstantFP::get(APFloat(1.0))
Both forms work with SVN head right now so you can migrate as
2015 Jan 20
2
[LLVMdev] Bug in InsertElement constant propagation?
Does anybody else have an opinion on this issue? I'm planning to submit a patch which would add a new get method for ConstantDataVector taking an ArrayRef<Constant*> and use that in the few places in constant propagation where convertToFloat is used.
Let me know if you think there is a more obvious way to do it.
Right now the only way to create a ConstantDataVector are those method:
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
2005 Jun 07
5
Functions within functions in R and S-Plus
Sorry to bother you about a S-Plus related problem, but I hope someone
can help.
I have tried to "translate" some code from R to S-Plus (I have colleague
that insists on using S-Plus. And yes, I have tried to make him change
to R...)
The following code works out fine in R, but in S-Plus (S-PLUS 6.2 for
Windows Professional Ed.) I get the error message "Problem in
est.theta(x):
2014 Sep 19
2
[LLVMdev] More careful treatment of floating point exceptions
Hi Sanjay,
Thanks, I saw this flag and it's definitely should be considered, but
it appeared to me to be static characteristic of target platform. I'm
not sure how appropriate it would be to change its value from a front-end.
It says "Has", while optional flag would rather say "Uses" meaning that
implementation cares about floating point exceptions.
Regards,
Sergey
2015 Mar 07
2
[LLVMdev] cannot understand global c++API code
Hi all,
translating the following c code to llvm c++Api code, I can not understand
the result.
Perhaps someone could explain it to me.
c code
---------------------------------
struct stest {
int age;
float weight;
} foo={44,67.2};
int main() {
foo.weight=68.2;
...
----------------------------------------
API code
// this is clear
ConstantFP* const_float_102 =
2012 Nov 06
3
[LLVMdev] Error while linking LLVM files
Hi!
I'm trying to learn LLVM and I want to compile the Kaleidoscope compiler.
according to:
http://llvm.org/docs/tutorial/LangImpl3.html
I'm compiling it with:
clang++ -g -O3 test.cpp `llvm-config --cppflags --ldflags --libs core` -o
toy
and it indeed works.
The problem is that when using eclipse it forces me to divide the
compilation into two steps:
g++ -O0 -g3 -Wall -c