Displaying 20 results from an estimated 52 matches for "getdoublety".
2010 Jan 04
4
[LLVMdev] Getting Kaleidoscope to compile
...ror: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’:
toy.cpp:358: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘virtual llvm::Value* BinaryExprAST::Codegen()’:
toy.cpp:379: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
toy.cpp:379: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘llvm::Function* PrototypeAST::Codegen()’:
toy.cpp:407: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
toy.cpp:407: error: ‘getGlobalContext’ was not declared in...
2019 Sep 26
2
ConstantFP->getType() is not right
...stant 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());
assert(constFloat2->getType() == llvm::Type::getDoubleTy(context));
but the second assert failed, the type of constFloat2 is still float, not
double, why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list...
2010 Jan 04
0
[LLVMdev] Getting Kaleidoscope to compile
...t declared in this scope
> toy.cpp: In member function ‘virtual llvm::Value*
> NumberExprAST::Codegen()’:
> toy.cpp:358: error: ‘getGlobalContext’ was not declared in this scope
> toy.cpp: In member function ‘virtual llvm::Value*
> BinaryExprAST::Codegen()’:
> toy.cpp:379: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
> toy.cpp:379: error: ‘getGlobalContext’ was not declared in this scope
> toy.cpp: In member function ‘llvm::Function* PrototypeAST::Codegen()’:
> toy.cpp:407: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
> toy.cpp:407: error: ‘getGlobalContext’...
2019 Jan 02
2
JIT compiler, Windows, external functions like cos
...smParser();
LLVMContext context;
IRBuilder<> builder(context);
std::unique_ptr<llvm::Module> module(new Module("TestModule", context));
Module* pModule = module.get();
auto externalFn_IR =
cast<Function>(pModule->getOrInsertFunction("externalFn",
Type::getDoubleTy(context), Type::getDoubleTy(context)));
Value* x = externalFn_IR->arg_begin();
x->setName("x");
BasicBlock *entryBlock = BasicBlock::Create(context, "EntryBlock",
externalFn_IR);
builder.SetInsertPoint(entryBlock);
std::vector<Type *> args(1, Type::getDoubleTy(con...
2011 May 31
2
[LLVMdev] How to identify LLVM version?
Hi, all
I'd like to write a code that can build different codes based on LLVM version.
Like code snippets in the below.
#ifdef __LLVM_29__
PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), 2, "iftmp");
#elif __LLVM_28__
PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), "iftmp");
#else
assert ("wrong version");
#endif
I've been trying to find something like these (__LLVM_29__, __LLVM_28__), but I could...
2012 Apr 23
1
[LLVMdev] Problem about the type of Function's arguement in llvm
...llvm::Value*, char const*, bool,
llvm::Instruction*) ()
code is like follows:
//#include necessary header files
int main(){
InitializeNativeTarget();
LLVMContext Context;
module = new Module("Program", Context);
vector<Type *> argslist;
argslist.push_back(Type::getDoubleTy(Context));
FunctionType *funType = FunctionType::get(Type::getDoubleTy(Context),
argslist, false);
Function *fun= cast<Function> ( module->getOrInsertFunction("fun",
funType));
BasicBlock * block = BasicBlock::Create(Context, "mainBlock", fun);
IRBuilde...
2009 Aug 23
1
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
...your function doesn't
> take parameters. Maybe using an irbuilder would help?
It does take one parameter. Here's the important bits:
// My Function
extern "C"
void print(double X) {
printf("%f\n", X);
}
// Args type
std::vector<const Type*> args(1, Type::getDoubleTy(getGlobalContext()));
// return void, 1 arg double, no varargs
FT = FunctionType::get(Type::getVoidTy(getGlobalContext()), args, false);
// creating stub for print function
Function* printFunction = Function::Create(FT,
Function::ExternalLinkage, "print", module);
By doing this (and the...
2016 Sep 19
3
llvm interpreter does not find function defined by addGlobalMapping
...llvm::Module>(pModule)
).setEngineKind(llvm::EngineKind::Interpreter).create();
pModule->setDataLayout(pExecutionEngine->getDataLayout());
// declaration of the c function.
std::vector<llvm::Type *> noArgTypes;
llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getDoubleTy(context),noArgTypes, false);
auto pFunction = llvm::Function::Create(ft, llvm::Function::ExternalLinkage, "testFunction",pModule);
pExecutionEngine->addGlobalMapping(pFunction,reinterpret_cast<void*>(&testFunction));
// generation of llvm code
auto pBlock = llvm::Bas...
2011 Nov 14
2
[LLVMdev] Transferring value* in LLVM
Hello
I want to transfer value (Value* src) of the type `FloatTyID` to
`DoubleTyID`(I need all floats to be saved as 8 bytes).I have tried:
builder.CreateCast(llvm::Instruction::FPExt, src,
llvm::Type::getDoubleTy(llvmContext),””)
I don`t know if I use CreateCast correctly and if this approach is correct
at all.
Thank you.
Yakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111114/8fe292a5/attachment.html>
2010 Jan 04
2
[LLVMdev] Getting Kaleidoscope to compile
...>> toy.cpp: In member function ‘virtual llvm::Value*
>> NumberExprAST::Codegen()’:
>> toy.cpp:358: error: ‘getGlobalContext’ was not declared in this scope
>> toy.cpp: In member function ‘virtual llvm::Value*
>> BinaryExprAST::Codegen()’:
>> toy.cpp:379: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
>> toy.cpp:379: error: ‘getGlobalContext’ was not declared in this scope
>> toy.cpp: In member function ‘llvm::Function* PrototypeAST::Codegen()’:
>> toy.cpp:407: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
>> toy.cpp:407: error: ‘ge...
2011 Nov 14
2
[LLVMdev] Transferring value* in LLVM
...y simpler.
>
> Ciao, Duncan.
>
>
>> I want to transfer value (Value* src) of the type `FloatTyID` to
>> `DoubleTyID`(I
>> need all floats to be saved as 8 bytes).I have tried:
>>
>> builder.CreateCast(llvm::Instruction::FPExt, src,
>> llvm::Type::getDoubleTy(llvmContext),””)
>>
>> I don`t know if I use CreateCast correctly and if this approach is
>> correct at all.
>>
>> Thank you.
>>
>> Yakov
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing l...
2015 Apr 16
3
[LLVMdev] double* to <2 x double>*
Does anyone know how to instrument *double* to <2 x doulbe>**, e.g., 2.2
--> <2.2, 2.2>?
For example, I want to change the following IR code
%arrayidx1 = getelementptr inbounds [100 x double]* @main.B, i32 0, i32
%i.021
%1 = load double* %arrayidx1, align 4, !tbaa !0
to:
%arrayidx1 = getelementptr inbounds [100 x double]* @main.B, i32 0, i32
%i.021
%1 = bitcast double* %arrayidx1
2012 Apr 22
0
[LLVMdev] Problem about the type of Function's arguement in llvm
hi
On Sun, Apr 22, 2012 at 8:36 PM, Jianfei Hu <hujianfei258 at gmail.com> wrote:
> in the tutorial of official llvm doc, chapter 3, it deals with arguement of
> function as follow:
>
> for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
> ++AI, ++Idx) {
> AI->setName(Args[Idx]);
>
> // NamedValues is map<string, Value*>
2010 May 28
2
[LLVMdev] Retrieving Underlying Type from AllocaInst
Is there a recommended way to retrieve the original type from an AllocaInst object?
For example, I am creating alloca instructions using the IRBuilder interface like:
alloca = builder.CreateAlloca( Type::getDoubleTy( context ), 0, variableName.c_str() );
and I place the alloca into a symbol table.
Later when I am generating instructions for an assignment operation, I want to check the type of the variable allocated with the CreateAlloca instruction so I can see if I need to do type conversion before the stor...
2011 Nov 14
2
[LLVMdev] Transferring value* in LLVM
...t;>> I want to transfer value (Value* src) of the type `FloatTyID` to
>>>> `DoubleTyID`(I
>>>> need all floats to be saved as 8 bytes).I have tried:
>>>>
>>>> builder.CreateCast(llvm::**Instruction::FPExt, src,
>>>> llvm::Type::getDoubleTy(**llvmContext),””)
>>>>
>>>> I don`t know if I use CreateCast correctly and if this approach is
>>>> correct at all.
>>>>
>>>> Thank you.
>>>>
>>>> Yakov
>>>>
>>>>
>>>>
>>&...
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
...,
constint1);
auto *size = builder.CreatePtrToInt(p, llvm::IntegerType::get(context,
64));
and type definitions:
auto *constint1 = llvm::ConstantInt::get(context, llvm::APInt(64, 1));
auto *int64Ty = llvm::IntegerType::get(context, 64);
auto *doubleTy = llvm::Type::getDoubleTy(context);
auto *structTy = llvm::StructType::create(context, "Foo");
structTy->setBody({int64Ty, doubleTy});
auto *pointerTy = llvm::PointerType::get(structTy, 0);
take care that the "size" is a "llvm::Value" type, not a
"llvm::constantInt" type, this lea...
2012 Apr 22
2
[LLVMdev] Problem about the type of Function's arguement in llvm
in the tutorial of official llvm doc, chapter 3, it deals with arguement
of function as follow:
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
++AI, ++Idx) {
AI->setName(Args[Idx]);
// NamedValues is map<string, Value*>
NamedValues[Args[Idx]] = AI;
and when it try to get the value of arguement, it simply does:
Value
2011 May 31
0
[LLVMdev] How to identify LLVM version?
Kangkook Jee <aixer77 at gmail.com> writes:
> Hi, all
>
> I'd like to write a code that can build different codes based on LLVM version.
> Like code snippets in the below.
>
> #ifdef __LLVM_29__
> PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), 2, "iftmp");
> #elif __LLVM_28__
> PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), "iftmp");
> #else
> assert ("wrong version");
> #endif
>
> I've been trying to find something like these (__LL...
2011 Nov 14
0
[LLVMdev] Transferring value* in LLVM
...You can also use CreateFPExt which is
slightly simpler.
Ciao, Duncan.
> I want to transfer value (Value* src) of the type `FloatTyID` to `DoubleTyID`(I
> need all floats to be saved as 8 bytes).I have tried:
>
> builder.CreateCast(llvm::Instruction::FPExt, src,
> llvm::Type::getDoubleTy(llvmContext),””)
>
> I don`t know if I use CreateCast correctly and if this approach is correct at all.
>
> Thank you.
>
> Yakov
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.c...
2011 Nov 14
0
[LLVMdev] Transferring value* in LLVM
....
>>
>>
>>> I want to transfer value (Value* src) of the type `FloatTyID` to
>>> `DoubleTyID`(I
>>> need all floats to be saved as 8 bytes).I have tried:
>>>
>>> builder.CreateCast(llvm::Instruction::FPExt, src,
>>> llvm::Type::getDoubleTy(llvmContext),””)
>>>
>>> I don`t know if I use CreateCast correctly and if this approach is
>>> correct at all.
>>>
>>> Thank you.
>>>
>>> Yakov
>>>
>>>
>>>
>>> ______________________________________...