Displaying 20 results from an estimated 954 matches for "dyn_cast".
2018 Feb 06
2
6 separate instances of static getPointerOperand(). Time to consolidate?
...ternatives?
Thanks,
Hideki
-----------
Relevant background info
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120164.html
if anyone is curious about my cleanup work.
------------- Analysis/Delinearization.cpp
static Value *getPointerOperand(Instruction &Inst) {
if (LoadInst *Load = dyn_cast<LoadInst>(&Inst))
return Load->getPointerOperand();
else if (StoreInst *Store = dyn_cast<StoreInst>(&Inst))
return Store->getPointerOperand();
else if (GetElementPtrInst *Gep = dyn_cast<GetElementPtrInst>(&Inst))
return Gep->getPointerOperand()...
2018 Feb 06
0
6 separate instances of static getPointerOperand(). Time to consolidate?
...-
> Relevant background info
> http://lists.llvm.org/pipermail/llvm-dev/2018-January/120164.html
> if anyone is curious about my cleanup work.
>
> ------------- Analysis/Delinearization.cpp
>
> static Value *getPointerOperand(Instruction &Inst) {
> if (LoadInst *Load = dyn_cast<LoadInst>(&Inst))
> return Load->getPointerOperand();
> else if (StoreInst *Store = dyn_cast<StoreInst>(&Inst))
> return Store->getPointerOperand();
> else if (GetElementPtrInst *Gep = dyn_cast<GetElementPtrInst>(&Inst))
> return Ge...
2008 Dec 10
2
[LLVMdev] dyn_cast really doesn't like multiple inheritance
Been having a bit of a problem with dyn_cast: Suppose I have a class A
that inherits from two base classes, both of which support dyn_cast. In
order to use dyn_cast on A, I need to do a bunch of extra work:
1) Since dyn_cast uses reinterpret_cast rather than static_cast, the
pointer value won't get adjusted by the cast operation, maki...
2018 Feb 06
1
6 separate instances of static getPointerOperand(). Time to consolidate?
...ction that returns the pointer operand of a load or store
/// instruction.
static Value *getPointerOperand(Value *I) {
if (auto *LI = dyn_cast<LoadInst>(I))
return LI->getPointerOperand();
if (auto *SI = dyn_cast<StoreInst>(I))
return SI->getPointerOperand();
return nullptr;
}
/// A helper function that returns the type of loaded or stored value....
2004 Sep 03
2
[LLVMdev] diffs for vc7.1
On Fri, Sep 03, 2004 at 03:01:01PM -0500, Anshu Dasgupta wrote:
> ><snip>
> >for (BasicBlock::iterator I = Dest->begin(); PHINode *PN =
> >dyn_cast<PHINode>(I); ++I)
> > visitPHINode(*PN);
> ><snip>
> >
> >build_vc71\lib\Transforms\Scalar\SCCP.cpp(202) : error C2275:
> >'llvm::PHINode' : illegal use of this type as an expression
> >
> >but I think is a NO-NO, so suggestions?
>...
2004 Jun 17
1
[LLVMdev] Small dyn_cast embellishment
It appears that LLVM has quite a number of dyn_casts (which I find quite
natural) The suggested idiom:
if (ConstantExpr* ce = dyn_cast<ConstantExpr>(*j)) {
}
is fine, and IIRC even used in TC++PL, but it occured to me that we can do
even better:
if (dyn_caster<ConstantExpr> ce = *j) {
}
where dyn_caster is defined lik...
2010 Nov 13
3
[LLVMdev] dyn_cast vs. dynamic_cast
LLVM has a relatively large number of proprietary replacements for
standard C++ functions and classes. One of these is dyn_cast to
replace dynamic_cast. The two calls appear to be semantically
equivalent; the only difference that I can see is that dyn_cast
reportedly works on classes that have no v-table [1]. Could someone
please explain why I should use dyn_cast instead of dynamic_cast? (I
thought all classes hav...
2013 Nov 26
2
[LLVMdev] LLVM compilation problem
...us
llvm/include/llvm/IR/InstrTypes.h:617: error: call of overloaded `cast(const llvm::Value*&)' is ambiguous
llvm/include/llvm/IR/InstrTypes.h:822: error: call of overloaded `cast(const llvm::Value*&)' is ambiguous
llvm/include/llvm/IR/InstrTypes.h:827: error: call of overloaded `dyn_cast(llvm::Type*&)' is ambiguous
llvm/include/llvm/Support/Casting.h:249: error: call of overloaded `cast(llvm::Value*&)' is ambiguous
llvm/lib/Support/YAMLTraits.cpp:88: error: call of overloaded `dyn_cast(llvm::yaml::Input::HNode*&)' is ambiguous
llvm/lib/Support/YAMLTraits....
2010 Nov 15
2
[LLVMdev] dyn_cast vs. dynamic_cast
On Nov 12, 2010, at 5:57 PM, Óscar Fuentes wrote:
>> Could someone
>> please explain why I should use dyn_cast instead of dynamic_cast? (I
>> thought all classes have v-tables...) Thanks,
>
> For reducing executable size, LLVM builds with RTTI disabled where
> possible.
Right, but how does that relate to dyn_cast? I thought v-tables were
present even when RTTI is not (because otherwise pol...
2007 Dec 17
0
[LLVMdev] Elsa and LLVM and LLVM submissions
...---------------------------
> ===//
> +
> + template<typename InputIterator>
> + Value *CreateGEP(Value *Ptr, InputIterator IdxBegin,
> + InputIterator IdxEnd, const char
> *Name = "") {
> +#if RICH
> + if (Constant *PC = dyn_cast<Constant>(Ptr)) {
> + // Every index must be constant.
> + InputIterator i;
> + for (i = IdxBegin; i < IdxEnd; ++i) {
> + if (!dyn_cast<Constant>(*i)) {
> + break;
> + }
> + }
> + if (i == IdxEnd) {
> + return...
2004 Sep 03
0
[LLVMdev] diffs for vc7.1
I can confirm that both are compiled properly:
A)
PHINode *PN;
for (BasicBlock::iterator I = H->begin(); PN = dyn_cast<PHINode>(I);
I++)
....
B)
for (BasicBlock::iterator I = H->begin; isa<PHINode>(I); I++) {
PHINode *PN = cast<PHINode(I);
....
}
I'll make a patch for whatever solution do you prefer (this problem is
a showstopper for more than a dozen files...)
---
Paolo I...
2010 Nov 13
0
[LLVMdev] dyn_cast vs. dynamic_cast
Trevor Harmon <Trevor.W.Harmon at nasa.gov> writes:
[snip]
> Could someone
> please explain why I should use dyn_cast instead of dynamic_cast? (I
> thought all classes have v-tables...) Thanks,
For reducing executable size, LLVM builds with RTTI disabled where
possible.
2011 Oct 19
2
[LLVMdev] dyn_cast<BitCastInst> fails?
I am trying to dyn_cast a Value* to a BitCastInst. The dump of what I
want casted is "i8* bitcast (i32 (i32)* @f1 to i8*)", so it is a
BitCastInst. For someone my dyn_cast always fails, does anyone see
why?
arg->dump();
BitCastInst *bitcast = dyn_cast<BitCastInst>(arg);
assert(b...
2012 Dec 17
4
[LLVMdev] BasicBlock back()
...sicBlock::const_iterator I = BB.begin();
BasicBlock::const_iterator E = BB.end();
BasicBlock::const_iterator prev_iter,last_iter;
prev_iter = NULL; last_iter = NULL;
for(;I!=E;I++){
prev_iter = last_iter;
last_iter = I;
}
if(prev_iter){
errs() << "prev_iter: " << *(dyn_cast<Instruction>(prev_iter)) << "\n";
}
if(last_iter){
errs() << "last_iter: " << *(dyn_cast<Instruction>(last_iter)) << "\n";
}
// not related to the main question: uncomment the next line for an unusual
behavior: lastlast is DIFFER...
2007 Dec 17
2
[LLVMdev] Elsa and LLVM and LLVM submissions
Devang Patel wrote:
> On Dec 15, 2007, at 12:15 PM, Richard Pennington wrote:
>
>> I got the current version of LLVM via svn yesterday and modified my
>> code to
>> use the LLVMFoldingBuilder. Very nice!
>>
>> My question is this: I noticed that the folding builder doesn't fold
>> some
>> operations, e.g. casts. Is there some reason why? If
2012 Oct 05
2
[LLVMdev] TableGen: Requesting feedback for "TGContext"
> It won't cause a negative effect, go for it! Dynamic_cast is realllly slow compared to dyn_cast, it is worth the memory.
Ok, here's the first batch. It converts the RecTy hierarchy over to
use LLVM-style RTTI. Along the way, I also wrote up a new doc "How to
set up LLVM-style RTTI for your class hierarchy", which covers the
previously undocumented (albeit not that complicated)...
2002 Sep 17
3
[LLVMdev] questions
Sorry I got really overwhelmed by so many classes and member
functions in LLVM. So would you please clarify some problems
I have?
1. If I see this instruction in the function.
%S.i = alloca %struct.SimpleStruct
Suppose SimpleStruct is as following:
struct.SimpleStruct = type { int, double }
When I read the instruction, how can I know the type of
simplstruct, should I use 'getType'
2009 Apr 03
0
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi, Artur
> + if (isa<ConstantExpr>(I->constant)){
> + const ConstantExpr *CE =
> dyn_cast<ConstantExpr>(I->constant);
> + printConstantExpr(CE);
> + ty = CE->getType();
> + } else {
> + const Function * F = dyn_cast<Function>(I->constant);
> + printValueLoad(F);
> + ty = F->getType();
> +...
2004 Sep 03
0
[LLVMdev] diffs for vc7.1
Hi Paolo,
> <snip>
> for (BasicBlock::iterator I = Dest->begin(); PHINode *PN =
> dyn_cast<PHINode>(I); ++I)
> visitPHINode(*PN);
> <snip>
>
> build_vc71\lib\Transforms\Scalar\SCCP.cpp(202) : error C2275:
> 'llvm::PHINode' : illegal use of this type as an expression
>
> but I think is a NO-NO, so suggestions?
Since it's fussy about a dec...
2012 Apr 12
0
[LLVMdev] detection of constant diagonal matrix * vector
...i post it here in case it is interesting for someone.
on my wish list
there is still an option for target independent optimizations to have x
* 0 = 0.
-Jochen
static void getIntVector(Value* value, SmallVector<int, 8>& values)
{
if (llvm::ConstantVector* constantVector =
llvm::dyn_cast<llvm::ConstantVector>(value))
{
// get components
llvm::SmallVector<llvm::Constant*, 8> elements;
constantVector->getVectorElements(elements);
int numElements = int(elements.size());
for (int i = 0; i < numElements; ++i)
{...