search for: internallinkage

Displaying 20 results from an estimated 85 matches for "internallinkage".

2009 Jun 18
3
[LLVMdev] Initialising global Array
...mEdges); > APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero); > APInt minusone(32,-1); Constant* minusonec = ConstantInt::get(minusone); Create the global array, there is no initializer yet. > GlobalVariable *Counters = > new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, > Constant::getNullValue(ATy), "OptimalEdgeProfCounters", &M); Then exactly "NumEdges" constants are pushed to the "Initializer": > Initializer[i] = zeroc; > .. > Initializer[i] = minusonec; > .. And then I set the initi...
2011 May 18
2
[LLVMdev] access array problem
...> written them in some kind of C-style idiom. What are the declarations in > LLVM IR? const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATyC), "MemTraceCounterSize"); const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000); GlobalVariable *Counters = new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "MemTraceCounters"); >&gt...
2011 May 18
0
[LLVMdev] access array problem
...kind of C-style idiom. What are the declarations in >> LLVM IR? > const Type *IntTy = Type::getInt32Ty(M.getContext()); > const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); > > GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, > GlobalValue::InternalLinkage, > Constant::getNullValue(ATyC), "MemTraceCounterSize"); so CounterSize is an array of length 1, containing a single 64 bit integer. Using an array seems rather pointless here. > > const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000); > GlobalVariable *Co...
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
...ng namespace llvm; using namespace std; Constant* mk_string(Module *M, LLVMContext &Context, const string &svalue) { ArrayType *Ty = ArrayType::get(Type::getInt8Ty(Context),svalue.size()+1); GlobalVariable *GV = new llvm::GlobalVariable( *M, Ty, true, GlobalValue::InternalLinkage, ConstantArray::get(Context,svalue), "str", 0, false, 0); vector<Constant*> idxs; idxs.push_back(ConstantInt::get(Type::getInt32Ty(Context), 0, false)); idxs.push_back(ConstantInt::get(Type::getInt32Ty(Context), 0, false)); return (GetElementPtr...
2009 Jun 18
0
[LLVMdev] Initialising global Array
...; std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero); APInt minusone(32,-1); Constant* minusonec = ConstantInt::get(minusone); GlobalVariable *Counters = new GlobalVariable(ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "OptimalEdgeProfCounters1", &M); Initializer[0] = zeroc; Initializer[1] = minusonec; Initializer[2] = minusonec; Initializer[3] = zeroc; Constant *init = llvm::ConstantArray::get(ATy, Initializer); Counters->setInitializer(init);...
2014 Aug 28
4
[LLVMdev] How to tell whether a GlobalValue is user-defined
>> Agreed. If ld64 can drop support for .o produced by the old gcc that >> would be awesome. Failing that, what is really needed is > Because of static archives, the linker has to support old .o files for quite a while. I also don’t know when clang starting getting this right. r123585 (Jan 16 17:19:34 2011) I think. > Also, this seems like linker complexity for a very
2011 May 18
2
[LLVMdev] access array problem
...I rewrote the code, please help check why it still does not work: //declare global variable const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATyC), "MemTraceCounterSize"); const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000); GlobalVariable *Counters = new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage,...
2004 Jun 17
4
[LLVMdev] generating instructions with embedded ConstantExprs from within LLVM
...is this done? Everything logical I have tried has failed, here was one attempt: Constant *C = (Constant*) ConstantArray::get(inst2string(I)); //fucnction defined elsewhere //generates a correct Global string GlobalVariable *str = new GlobalVariable(C->getType(), true, GlobalValue::InternalLinkage, C, mkStrName( strNumber++ ), &M); std::vector<Value*> params; //params to a CallInst std::vector<Value*> indices; //indices to gep indices.push_back((Value*) (ConstantInt::get(Type::IntTy, 0))); indices.push_back((Value*) (ConstantInt::get(Type::IntTy, 0)))...
2019 Jan 29
2
[cfe-dev] Create a BlockAddress array from LLVM Pass
..... > > > BlockAddress *bba = BlockAddress::get(fn, bb); > > tmp.push_back(bba); > > > GlobalVariable *gvar_ptr_abc = new GlobalVariable( > > /*Module=*/*fn->getParent(), > > /*Type=*/PointerTy, > > /*isConstant=*/false, > > /*Linkage=*/GlobalValue::InternalLinkage, > > /*Initializer=*/0, // has initializer, specified below > > /*Name=*/"labelTracker"); > > gvar_ptr_abc->setAlignment(16); > > Constant *blockItems = ConstantDataArray::get(fn->getContext(), tmp); > > gvar_ptr_abc->setInitializer(blockItems); >...
2015 Jul 21
1
[LLVMdev] RFC: ThinLTO Symbol Linkage and Renaming
...fferent definition. > > > > 4 Static Values > > > > File static functions and variables have local linkage types (i.e. > internal or private), and are discardable. These values need special > handling during importing as described below. The local linkage types > InternalLinkage and PrivateLinkage (private is the same as internal but is > omitted from the symbol table) are handled the same for ThinLTO. > > > > 4.1 Static Variables > > > > Read-write or address taken static variables must always be promoted to > global scope (i.e. non-discarda...
2015 Jul 24
3
[LLVMdev] LLVM linkage flags
...ODRLinkage: Same, but only replaced by something equivalent. > > WeakAnyLinkage: Keep one copy of named function when linking (weak) > > WeakODRLinkage: Same, but only replaced by something equivalent. > > AppendingLinkage: Special purpose, only applies to global arrays. > > InternalLinkage: Rename collisions when linking (static functions). > > PrivateLinkage: Like Internal, but omit from symbol table. > > ExternalWeakLinkage: ExternalWeak linkage description. > > CommonLinkage: Tentative definitions. > When I have source code like: int x = 0; int main(){...}...
2011 Jan 12
2
[LLVMdev] How to define a global variable?
...wrote: >> @x = external global %0* > > Hi Rob, > > Try removing the 'extern', as it implies the variable storage is > elsewhere (ie. another object file). > I have to pass something from the LinkageTypes enum to the constructor. I tried others, like GlobalVariable::InternalLinkage, which dumps as "internal global" but the error was the same. Rob
2010 Aug 27
2
[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
...his error even when I only have an > empty 'main' function. So I couldn't create .ll file reproducing it > and I have to debug myself. > > The function causing the problem is stub created in > JIT::runFunction: Function *Stub = Function::Create(STy, > Function::InternalLinkage, "" ... > > Here is the log of machine instructions before and after > emitEpilogue for this function: > * PEI::insertPrologEpilogCode: === >> before emitEpilogue > - insn: PUSH64r %RBP<kill>, %RSP<imp-def>, %RSP<imp-use> > - insn: PROLOG_LABE...
2015 Jul 14
3
[LLVMdev] RFC: ThinLTO Symbol Linkage and Renaming
..., the linkonce variable definitions are therefore imported and available. 4 Static Values File static functions and variables have local linkage types (i.e. internal or private), and are discardable. These values need special handling during importing as described below. The local linkage types InternalLinkage and PrivateLinkage (private is the same as internal but is omitted from the symbol table) are handled the same for ThinLTO. 4.1 Static Variables Read-write or address taken static variables must always be promoted to global scope (i.e. non-discardable, non-local linkage) if they are imported to...
2019 Jan 28
2
Create a BlockAddress array from LLVM Pass
...std::vector<BlockAddress *> tmp; Function *fn = ... BasicBlock *bb = ... BlockAddress *bba = BlockAddress::get(fn, bb); tmp.push_back(bba); GlobalVariable *gvar_ptr_abc = new GlobalVariable( /*Module=*/*fn->getParent(), /*Type=*/PointerTy, /*isConstant=*/false, /*Linkage=*/GlobalValue::InternalLinkage, /*Initializer=*/0, // has initializer, specified below /*Name=*/"labelTracker"); gvar_ptr_abc->setAlignment(16); Constant *blockItems = ConstantDataArray::get(fn->getContext(), tmp); gvar_ptr_abc->setInitializer(blockItems); I get error with following: Unsupported type in Type::...
2004 Oct 13
1
[LLVMdev] creating Internal GlobalVaraibles
Here is my code, (GV is a GlobalVariable*): GV = new GlobalVariable(AI->getType(), false, GlobalValue::InternalLinkage, 0, "temp_glob", &M); I tell it to make it with internal linkage, but when I run the pass it makes them external: %temp_glob = external global [10 x int]* ; <[10 x int]**> [#uses=2] %temp_glob = external global [10 x float]* ; <[10 x float]**>...
2013 Jan 07
1
[LLVMdev] Question on using GlobalVariable as function pointer
Hi everyone, I am trying to have an call instruction that calls global variable The first thing I do is gv = new llvm::GlobalVariable( *(tb->getModule()), fty, false,GlobalValue::InternalLinkage,0, "",0,0,0); fty : i32 ({ i32, [32 x i32] }*) I get stuck here, the fifth argument is the initializer which is a LLVM Constant, I do not know how to describe a function pointer as a constant. so currently, I just pass false to it. then I use myjit->...
2008 Aug 01
2
[LLVMdev] Sparc assembly syntax
..." and that works just fine. My (temporary) solution is a hack, however: ================================================================== --- SparcAsmPrinter.cpp (revision 720) +++ SparcAsmPrinter.cpp (working copy) @@ -263,7 +263,7 @@ // FALL THROUGH case GlobalValue::InternalLinkage: if (C->isNullValue()) - SwitchToDataSection(".bss", I); + SwitchToDataSection("\t.section\t\".bss\"", I); else SwitchToDataSection(".data", I); break; My question is: What is the &qu...
2006 Jun 25
1
[LLVMdev] adding args to func call
...e of this code, in particular the last 4 lines? Are the duplicate lines intentional? /* m is Module*, f is Function*, i is Instruction* */ Constant* constStr = ConstantArray::get("test\n"); GlobalVariable* gv = new GlobalVariable (constStr->getType(), true, GlobalValue::InternalLinkage, constStr, "", m); std::vector<Constant*> geplist; geplist.push_back(ConstantUInt::get(Type::UIntTy,0)); geplist.push_back(ConstantUInt::get(Type::UIntTy,0)); Constant* gep = ConstantExpr::getGetElementPtr(gv,geplist); -- Jerry Hom
2012 Apr 08
1
[LLVMdev] Privatize global variables
Hi John, > The -internalize pass changes globals to have internal linkage. Does this > not suffice for your needs? To my understanding, it does not. The -internalize pass performs: I->setLinkage(GlobalValue::InternalLinkage); which means it only changes the linkage mode, while global variables remain in place. And we need to *replace* globals with local variables in main and arguments - in other functions. - D. 2012/4/8 John Criswell <criswell at illinois.edu>: > On 4/7/12 7:28 PM, Dmitry N. Mikushin wrote...