Displaying 11 results from an estimated 11 matches for "copyattributesfrom".
2014 Feb 08
2
[LLVMdev] Why doesn't GlobalVariable::copyAttributesFrom copy the thread local mode?
GlobalVariable::copyAttributesFrom sets the target thread local mode to
either general dynamic or not thread local rather than copying the thread
local mode from the source. Is that intentional or an oversight?
Thanks,
Keno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pip...
2011 Mar 06
2
[LLVMdev] how to zero-init a global
Hi!
I have a module containing a constant e.g.
@input = global %0 zeroinitializer, align 16
when I copy the global into another module I use
newGlobal->copyAttributesFrom(global);
but the new module now has
@input = external global %0, align 16
i.e. the zeroinitializer is missing. how do I set it or
copy it from the other global?
-Jochen
2011 Mar 06
0
[LLVMdev] how to zero-init a global
On Sun, Mar 6, 2011 at 9:52 PM, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:
> I have a module containing a constant e.g.
>
> @input = global %0 zeroinitializer, align 16
>
> when I copy the global into another module I use
> newGlobal->copyAttributesFrom(global);
> but the new module now has
>
> @input = external global %0, align 16
>
> i.e. the zeroinitializer is missing. how do I set it or
> copy it from the other global?
The initializer doesn't count as an attribute, I guess.
if (global->hasInitializer())
newGloba...
2012 May 15
1
[LLVMdev] CloneFunctionInto() overwrites alignment attribute
Hi everybody,
I am trying to clone a function body into an existing declaration.
That declaration has the same number of parameters but they differ in
type and alignment.
Fortunately, it does not care about the type.
Unfortunately, CloneFunctionInto() copies the attributes from the old
function to the new one unconditionally, overwriting the alignment
attribute.
Also, the Attribute interface
2013 May 15
1
[LLVMdev] Attributes & CloneFunctionInto
Hi John,
thanks for the pointer. However, I'd rather avoid rolling a custom
implementation. After all, it's not like I want to do something
drastically different...
I had sorted out the problem for 3.2 as well as a previous version of
3.3 trunk, but the API changed about a hundred times. Now as it
apparently has stabilized, I moved to a the 3.3 release branch just to
find that even
2011 Sep 16
2
[LLVMdev] How to duplicate a function?
...ector<Type*> Params(FTy->param_begin(), FTy->param_end());
FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params,
false);
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, Fn->getLinkage());
NF->copyAttributesFrom(Fn);
Fn->getParent()->getFunctionList().insert(Fn, NF);
NF->takeName(Fn);
for (Function::arg_iterator AI=F.arg_begin(), AE=F.arg_end(),
NAI=NF->arg_begin();
AI != AE; ++AI, ++NAI) {
NAI->takeName(AI);
}
// Since we have now create the new functi...
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
...ector<Type*> Params(FTy->param_begin(), FTy->param_end());
FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params,
false);
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, Fn->getLinkage());
NF->copyAttributesFrom(Fn);
Fn->getParent()->getFunctionList().insert(Fn, NF);
NF->takeName(Fn);
for (Function::arg_iterator AI=F.arg_begin(), AE=F.arg_end(),
NAI=NF->arg_begin();
AI != AE; ++AI, ++NAI) {
NAI->takeName(AI);
}
// Since we have now create the new functi...
2008 Sep 13
3
[LLVMdev] Duplicate Function with duplicated Arguments
I'm now writing a pass and I wanna ask a question about how to
duplicate the function and add duplicated arguments in llvm, for
example:
func(int a, char *b) -> func(int a, char *b, int a1, char *b1)
I'm now stuck at using "getOrInsertFunction" and how to handle
"getArgumentList", please share your opinion, thanks a lot!
James
2016 Aug 04
4
help please: how to sort the contents of a "SymbolTableListTraits<GlobalVariable>"?
...dded to "llvm/lib/IR/Globals.cpp" [and commented out the relevant deletion in
"llvm/include/llvm/IR/GlobalVariable.h"] -----
GlobalVariable::GlobalVariable(const GlobalVariable& GV) : GlobalVariable( GV.getValueType(),
GV.isConstant(), GV.getLinkage() ) { // copy ctor
copyAttributesFrom(&GV);
}
main_with_3_globals.c
---------------------
int foo;
char bar;
long baz;
int main(){return foo;}
----- error dump from compiler driver -----
> ../build_003/bin/clang main_with_3_globals.c -O3
Abe was here: max. profitable alignment: 16
Abe was here: found a globa...
2016 Jul 27
2
help please: how to sort the contents of a "SymbolTableListTraits<GlobalVariable>"?
Dear all,
In the process of trying to add optimization for better layout of global variables, I have run
up against a roadblock: I don`t seem to be able to sort the contents of a
"SymbolTableListTraits<GlobalVariable>" -- or even swap two elements in that list -- without
causing LLVM to crash.
I have tried writing a comparator class and then using "llvm::iplist<
2013 Jul 12
14
[LLVMdev] [Proposal] Parallelize post-IPO stage.
...op_back();
+ }
+}
+
+Function *ModPartXform::CreateFuncDecl(const Function *F, Module *NewModule) {
+ Function *NF = Function::Create(F->getFunctionType(),
+ GlobalValue::ExternalLinkage,
+ F->getName(), NewModule);
+ NF->copyAttributesFrom(F);
+ return NF;
+}
+
+static void PromoteGlobalVarLinkage(GlobalVariable *GV) {
+ GV->setLinkage(GlobalValue::ExternalLinkage);
+}
+
+static void PromoteGlobalFuncLinkage(Function *F) {
+ F->setLinkage(GlobalValue::ExternalLinkage);
+}
+
+GlobalVariable *ModPartXform::CreateVarDecl(cons...