Displaying 11 results from an estimated 11 matches for "getpointercast".
Did you mean:
getpointerbase
2011 Aug 01
1
[LLVMdev] SwitchInst::addCase with BlockAddress
...gers (at least not at
> compile-time).
>
> You can use an explicit comparison+branch, though.
BlockAddress is a class derived from Constant, so I thought it was
meant to be, well, constant.
Besides, as
I wrote, it is possible to get a ConstantExpr from a
BlockAddress via ConstantExpr::getPointerCast (that in turn calls
ConstantExpr::getPtrToInt).
Unfortunately, getPointerCast returns a Constant, not a ConstantInt;
moreover, dyn_cast<ConstantInt> on that Constant returns null.
What I'm missing is, therefore, how do I get a ConstantInt out of a
Constant obtained via ConstantExpr::ge...
2019 Jan 15
2
Function - replaceAllUsesWith
I could actually track down the cause of the problem:
mainModue->getFunction("puts")->replaceAllUsesWith(
llvm::ConstantExpr::getPointerCast(
llvm::ConstantInt::get(llvm::IntegerType::get(context, 64), 0xF),
mainModue->getFunction("puts")->getType()
)
);
The problem is the line where I receive the type of the function "puts", it will crash the application - when used as the parameter for "getPointerCast&qu...
2011 Jul 31
3
[LLVMdev] SwitchInst::addCase with BlockAddress
I'm trying to figure out how to feed a blockaddress to a switch
condition AND destination (basically emulating an indirectbr via a
switch; I know it's not a good approach, I'm just experimenting).
Suppose I have the following:
SwitchInst *s = SwitchInst::Create(...);
BasicBlock *bb = ...;
PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
2011 Aug 01
0
[LLVMdev] SwitchInst::addCase with BlockAddress
On Sun, Jul 31, 2011 at 7:36 AM, Carlo Alberto Ferraris
<cafxx at strayorange.com> wrote:
> I'm trying to figure out how to feed a blockaddress to a switch condition
> AND destination (basically emulating an indirectbr via a switch; I know it's
> not a good approach, I'm just experimenting).
> Suppose I have the following:
>
> SwitchInst *s =
2019 Jan 15
2
Function - replaceAllUsesWith
...at 14:04, Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:
> Is there a way to copy the value? I want to ensure to use the correct type...
I don't think copying is the issue, you're just passing pointers within a single Context around by the looks of it.
I have just noticed the getPointerCast actually only does ptrtoint but you want inttoptr, without assertions it's possible that's doing bad things in a non-obvious way. It should certainly be getIntToPtr anyway.
Cheers.
Tim.
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäft...
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
...work:
static int add(int x, int y);
llvm::Value *one, *two;
llvm::Constant* addfn
= llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add);
llvm::Type* args[] = { Int32Ty, Int32Ty };
llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty, args);
addfn = llvm::ConstantExpr::getPointerCast(addfn, ftype);
CreateCall(addfn, one, two);
---
Is there a way? Or must I call getOrInsertFunction?
Before anyone asks why I am doing this, it is because I have maybe 200
functions with the same signature that I would like JIT a call to. I
would like to avoid calling getOrInsertFunction 200 tim...
2019 Jan 15
2
Function - replaceAllUsesWith
Hey Tim,
Sadly I have currently only a release build of LLVM7 with no assertions turned on... So I just know that the line of code I posted is crashing.
No output, no anything....just...Crash...
Kind greetings
Björn
-----Original Message-----
From: Tim Northover <t.p.northover at gmail.com>
Sent: Dienstag, 15. Januar 2019 13:28
To: Gaier, Bjoern <Bjoern.Gaier at horiba.com>
Cc:
2019 Jan 15
2
Function - replaceAllUsesWith
...mply try overloading “puts” with a custom address before I start the JIT process. I want to replace the call to “puts” with my own address. For a test purpose I tried this now:
mainModue->getFunction("puts")->replaceAllUsesWith(
llvm::ConstantExpr::getPointerCast(
llvm::ConstantInt::get(llvm::IntegerType::get(context, 64), 0xF),
mainModue->getFunction("puts")->getType()
)
);
This code will crash the application though. I know that 0xF is not a correct ad...
2019 Jan 14
3
Function - replaceAllUsesWith
Hello LLVM-World,
currently I play around with a "llvm::Module" and an external function defined there "puts". Normally this function gets resolved in the JIT-Process but I wonder about two things:
1. Can I resolve the function already in this step? I used "replaceAllUsesWith" and passed a "llvm::ConstantInt" to the function. But this didn't
2011 Feb 04
3
[LLVMdev] ConstantBuilder proposal
...Constant *GetTruncOrBitCast(
Constant *C, ///< The constant to trunc or bitcast
const Type *Ty ///< The type to trunc or bitcast C to
) {
return ConstantExpr::getTruncOrBitCast(C, Ty);
}
/// @brief Create a BitCast or a PtrToInt cast constant expression
static Constant *GetPointerCast(
Constant *C, ///< The pointer value to be casted (operand 0)
const Type *Ty ///< The type to which cast should be made
) {
return ConstantExpr::getPointerCast(C, Ty);
}
/// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts
static Constant *GetInteg...
2019 Jan 15
2
Function - replaceAllUsesWith
...mply try overloading “puts” with a custom address before I start the JIT process. I want to replace the call to “puts” with my own address. For a test purpose I tried this now:
mainModue->getFunction("puts")->replaceAllUsesWith(
llvm::ConstantExpr::getPointerCast(
llvm::ConstantInt::get(llvm::IntegerType::get(context, 64), 0xF),
mainModue->getFunction("puts")->getType()
)
);
This code will crash the application though. I know that 0xF is not a correct ad...