Displaying 13 results from an estimated 13 matches for "const_arg_iterator".
2012 Mar 14
2
[LLVMdev] Lowering formal pointer arguments
Hi,
How can I get the llvm-type of the formal argument while lowering it ?
My target needs to map pointer and non-pointer parameters to different
registers. In addition, parameter lowering is address space dependent
(another reason why I need such information). Looking at the DAGBuilder,
I found that it is dropping it when translating llvm-types to BE types.
Even if the base type is saved
2012 Mar 15
0
[LLVMdev] Lowering formal pointer arguments
If you need llvm::Argument, this returns the iterator pointing to the
first argument:
Function::const_arg_iterator Arg =
DAG.getMachineFunction().getFunction()->arg_begin();
On Wed, Mar 14, 2012 at 8:16 AM, Ivan Llopard <ivanllopard at gmail.com> wrote:
> Hi,
>
> How can I get the llvm-type of the formal argument while lowering it ?
>
> My target needs to map pointer and non-pointer par...
2013 Jul 02
1
[LLVMdev] Problem selecting the correct registers for a calling convention
...entioned
the isSplit flag doesn't help here. There are 2 ways to analyze the
arguments of a function:
1) You can get a Function pointer in LowerFormalArguments, and in LowerCall
only when Callee can by dyn_casted to a GlobalAddressSDNode. By having this
pointer you can then do:
for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();I !=
E; ++I)
{
unsigned Bytes = TD->getTypeSizeInBits(I->getType()) / 8;
// do stuff here
}
2) The second case is when the dyn_cast above fails because the Callee
SDValue is a
ExternalSymbolSDNode. In this case you have to manually an...
2015 Jul 29
1
[LLVMdev] How to get the const argument data from Function?
...ippet:
f("hello")
, then compiled by Clang, I will have the “hello” as a *Constant Array* in
the IR code. My goal is to call APIs of LLVM to get the “hello” from IR
code.
Now suppose the I got the llvm::Function* fn from some Module, so I can get
the access the ArgumentList by iterator const_arg_iterator it.
However, the iterator now I got is of type llvm::ilist_iterator<const
llvm::Argument>::const_iterator. When I am trying to cast it into
`llvm::ilist_iterator<const
llvm::ConstantArray>::const_iterator, it can’t success. But if I get the
raw pointer out of it, the program will simpl...
2012 Mar 15
2
[LLVMdev] Lowering formal pointer arguments
Le 15/03/2012 03:07, Akira Hatanaka a écrit :
> If you need llvm::Argument, this returns the iterator pointing to the
> first argument:
>
> Function::const_arg_iterator Arg =
> DAG.getMachineFunction().getFunction()->arg_begin();
Thanks Akira.
Ivan
>
> On Wed, Mar 14, 2012 at 8:16 AM, Ivan Llopard<ivanllopard at gmail.com> wrote:
>> Hi,
>>
>> How can I get the llvm-type of the formal argument while lowering it ?
>>
>...
2011 Jul 06
2
[LLVMdev] First steps with LLVM and partial evaluation
...ValueToValueMapTy& ValueMap)
{
vector<const Type*> ArgTypes;
// The user might be deleting arguments to the function by specifying them in
// the ValueMap. If so, we need to not add the arguments to the arg ty vector
//
for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
I != E; ++I)
if (ValueMap.count(I) == 0) // Haven't mapped the argument to anything yet?
ArgTypes.push_back(I->getType());
// Create a new function type...
FunctionType *FTy = FunctionType::get(F->getFunctionTyp...
2017 Jun 09
2
Get segfault with ModulePass
...t>(use.getUser())) {
const Function* f = c->getCalledFunction();
if (f != nullptr) {
for (unsigned i = 0; i < c->getNumArgOperands(); ++i) {
const Use& u = c->getArgOperandUse(i);
if (u.operator->() == &I) {
Function::const_arg_iterator ai = f->arg_begin();
std::advance(ai, i);
for (const auto& use : ai->uses()) {
errs() << "next one\n";
if (const Instruction* user = dyn_cast<Instruction>(use.getUser())) {
errs() << "op_code2: &qu...
2012 Mar 15
0
[LLVMdev] Lowering formal pointer arguments
...ent: den 15 mars 2012 10:02
To: Akira Hatanaka
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Lowering formal pointer arguments
Le 15/03/2012 03:07, Akira Hatanaka a écrit :
> If you need llvm::Argument, this returns the iterator pointing to the
> first argument:
>
> Function::const_arg_iterator Arg =
> DAG.getMachineFunction().getFunction()->arg_begin();
Thanks Akira.
Ivan
>
> On Wed, Mar 14, 2012 at 8:16 AM, Ivan Llopard<ivanllopard at gmail.com> wrote:
>> Hi,
>>
>> How can I get the llvm-type of the formal argument while lowering it ?
>>
>...
2018 Sep 06
2
Replacing a function from one module into another one
...::string originalFileName = "tracer.ll";
const std::string referenceFileName = "tracer_ref.ll";
void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld,
llvm::Function *fNew) {
llvm::Function::arg_iterator DestI = fOld->arg_begin();
for (llvm::Function::const_arg_iterator J = fNew->arg_begin(); J !=
fNew->arg_end();
++J) {
DestI->setName(J->getName());
VMap[&*J] = &*DestI++;
}
void addFunction(llvm::Module *oMod, llvm::Module *nMod, std::string
nFName, std::string oFName) {
llvm::Function *fNew = nMod->getFunction(nFName);...
2018 Sep 06
2
Replacing a function from one module into another one
...code that I
saw necessary, but I still have some issues (references are still not
updated). I created the function:
void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld,
llvm::Function *fNew) {
llvm::Function::arg_iterator DestI = fOld->arg_begin();
for (llvm::Function::const_arg_iterator J = fNew->arg_begin(); J !=
fNew->arg_end();
++J) {
DestI->setName(J->getName());
VMap[&*J] = &*DestI++;
}
}
The same as in *CloneModule*, then I have this code:
llvm::Function *fNew = nMod->getFunction(nFName);
llvm::Function *fOld = oMod->getFunction(o...
2017 Jun 11
2
Get segfault with ModulePass
...const Use& u = c->getArgOperandUse(i);
> > if (u.operator->() == &I) {
> > Function::const_arg_iterator ai = f->arg_begin();
> > std::advance(ai, i);
> > for (const auto& use : ai->uses()) {
> >...
2018 Sep 04
2
Replacing a function from one module into another one
Hi Philip,
Thank you very much for your answer, the vector declaration example worked.
I'm pretty sure the ValueToValueMapTy is the last thing I need because I
even saw there is another function that could help me llvm*:*:RemapFunction
<http://llvm.org/doxygen/namespacellvm.html#addf0183e92893bdbcde00fc9091dda93>;
but my problem is that I don't know how to populate the
2013 Jul 12
14
[LLVMdev] [Proposal] Parallelize post-IPO stage.
...Function *OF = *I;
+ Function *NF = cast<Function>(VMap[OF]);
+
+ // Steal some code from llvm::CloneFunction.
+ {
+ // Loop over the arguments, copying the names of the mapped arguments over...
+ Function::arg_iterator DestI = NF->arg_begin();
+ for (Function::const_arg_iterator I = OF->arg_begin(), E = OF->arg_end();
+ I != E; ++I)
+ // Is this argument preserved? WTF, how come an argument is preserved?
+ if (VMap.count(I) == 0) {
+ DestI->setName(I->getName()); // Copy the name over...
+ VMap[I] = DestI++; // Add mapp...