search for: privatelinkage

Displaying 20 results from an estimated 29 matches for "privatelinkage".

2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...ConstantArray::get(block->getContext(), bar); GlobalVariable *g1 = NULL; GlobalVariable *g2 = NULL; g1 = new GlobalVariable( *F->getParent(), s1Ty, true, GlobalValue::PrivateLinkage, 0, ""); g1->setAlignment(1); g2 = new GlobalVariable( *F->getParent(), s2Ty, true, GlobalVa...
2017 Mar 31
2
How to write the same things as `opt` command in C++ API
.../// @brief Create function type (void) => i32 llvm::FunctionType *commonfuncType = llvm::FunctionType::get(llvm::Type::getInt32Ty(context), {}, false); /// @brief Create a function (define i32 a()) llvm::Function *aFun = llvm::Function::Create(commonfuncType, llvm::Function::PrivateLinkage, "a", module.get()); /// @brief Create a function (define i32 b()) llvm::Function *bFun = llvm::Function::Create(commonfuncType, llvm::Function::PrivateLinkage, "b", module.get()); /// @brief Create a function (define i32 c()) llvm::Function *cFun = l...
2010 Feb 16
3
[LLVMdev] Creating a global variable in JIT context
...This is the code I have for creating the global variable: const Type *type = Type::getInt32Ty(getGlobalContext()); // Constant *zerov = Constant::getNullValue(type); Constant *zerov = Constant::getIntegerValue(type, APInt(32, 0)); V = new GlobalVariable(getGlobalContext(), type, 0, GlobalValue::PrivateLinkage, zerov, name); And these are the error messages given by verifyFunction: Function return type does not match operand type of return inst! ret i32* @x i32Referencing global in another module! ret i32* @xBroken module found, compilation aborted! Any idea of what I might be doing wrong? Is this...
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...bar); > > GlobalVariable *g1 = NULL; > GlobalVariable *g2 = NULL; > > g1 = new GlobalVariable( *F->getParent(), > s1Ty, > true, > GlobalValue::PrivateLinkage, > 0, > ""); > g1->setAlignment(1); > > g2 = new GlobalVariable( *F->getParent(), > s2Ty, > true, >...
2012 Jul 23
2
[LLVMdev] static constant structs
...then pointer casting it to the appropriate type when I use it, but this seems overly clunky. Constant *cip = ConstantArray::get( ctx(), StringRef((char *)&addr_, sizeof(addr_)), false); return new GlobalVariable( *mod(), cip->getType(), true, GlobalVariable::PrivateLinkage, cip); In a previous version of my code, I replaced cip->getType() with the llvm equivalent of the type of addr_. This worked until I tried with a build of llvm that had assertions turned on. Even without that, I am hoping there is a better way to do this that I have managed to overlook. --...
2015 Jul 24
3
[LLVMdev] LLVM linkage flags
...Linkage: 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(){...} I end up with an ExternalLinkage flag on x. Why would this not have CommonLin...
2010 Feb 16
0
[LLVMdev] Creating a global variable in JIT context
...able: > > const Type *type = Type::getInt32Ty(getGlobalContext()); > // Constant *zerov = Constant::getNullValue(type); > Constant *zerov = Constant::getIntegerValue(type, APInt(32, 0)); > V = new GlobalVariable(getGlobalContext(), type, 0, > GlobalValue::PrivateLinkage, zerov, name); > > And these are the error messages given by verifyFunction: > > Function return type does not match operand type of return inst! > ret i32* @x i32Referencing global in another module! > ret i32* @xBroken module found, compilation aborted! > > Any idea of w...
2012 Jul 23
0
[LLVMdev] static constant structs
...iate type when I use it, but this > seems overly clunky. > > Constant *cip = ConstantArray::get( > ctx(), StringRef((char *)&addr_, sizeof(addr_)), false); > return new GlobalVariable( > *mod(), cip->getType(), true, > GlobalVariable::PrivateLinkage, cip); > > In a previous version of my code, I replaced cip->getType() with the > llvm equivalent of the type of addr_. This worked until I tried with a > build of llvm that had assertions turned on. Even without that, I am > hoping there is a better way to do this that I have m...
2014 Feb 21
12
[LLVMdev] asan coverage
...PGOBuilder.CreateBitCast(RegionCounters, Int64PtrTy), + PGOBuilder.CreateBitCast(RegionPCs, Int64PtrTy)); } llvm::Function *CodeGenPGO::emitInitialization(CodeGenModule &CGM) { @@ -769,6 +771,13 @@ llvm::GlobalVariable::PrivateLinkage, llvm::Constant::getNullValue(CounterTy), "__llvm_pgo_ctr"); + + RegionPCs = + new llvm::GlobalVariable(CGM.getModule(), CounterTy, false, + llvm::GlobalVariable::PrivateLinkage, +...
2010 Jan 11
2
[LLVMdev] Operations on constant array value?
2010/1/11 Garrison Venn <gvenn.cfe.dev at gmail.com> > I have not tried this, but a linkage type of PrivateLinkage would not add > to the symbol table according > to the doc. > > LLVMSetLinkage(g, LLVMPrivateLinkage); > Thanks - I hadn't thought of that. > > Garrison > > On Jan 11, 2010, at 14:03, James Williams wrote: > > 2010/1/11 Eli Friedman <eli.friedman at gmail.c...
2010 Jan 11
0
[LLVMdev] Operations on constant array value?
I have not tried this, but a linkage type of PrivateLinkage would not add to the symbol table according to the doc. LLVMSetLinkage(g, LLVMPrivateLinkage); Garrison On Jan 11, 2010, at 14:03, James Williams wrote: > 2010/1/11 Eli Friedman <eli.friedman at gmail.com> > On Mon, Jan 11, 2010 at 7:07 AM, James Williams <junk at giantblob.com&...
2010 Jan 11
0
[LLVMdev] Operations on constant array value?
Sorry to keep this thread alive, but I'm learning so ... There is more. The doc for GlobalValue::LinkageTypes or the C API LLVMLinkage is not as clear as the lang ref manual. See: http://llvm.org/docs/LangRef.html#linkage. I'm pointing this out because something like LinkerPrivateLinkage (LLVMLinkerPrivateLinkage), or another one, might be more appropriate to your throw away use case (if I understand your use correctly). One should test this of course, and/or one of the experts could chime in hint hint. :-) Anyway thought this info. might be useful, however rehashed. Garrison...
2010 Jan 11
2
[LLVMdev] Operations on constant array value?
2010/1/11 Eli Friedman <eli.friedman at gmail.com> > On Mon, Jan 11, 2010 at 7:07 AM, James Williams <junk at giantblob.com> > wrote: > > Hi, > > > > I've read http://llvm.org/docs/LangRef.html#t_array and > > http://llvm.org/docs/GetElementPtr.html and if I've understood right > there > > are no operations that act directly on arrays -
2016 Nov 07
2
[llvm] To link or not to link
Hi, I have migrated an LLVM front-end from LLVM 3.5 to 3.8 and now to 3.9 and ORC, and there is a concept which I could not transfer. Consider: extern "C" { void somefunc() {} } … auto llvmfunc = llvm::Function::Create(type, llvmFunction::PrivateLinkage, "bla", module)); executionengine.addGlobalMapping(llvmfunc, &somefunc); // now I have llvmfunc to work with and don't need to consider anything else The GlobalMappingLayer class seems to provide the functionality I want. I oriented myself on the example from https://github.com/A...
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
2020 Sep 30
2
Creating a global variable for a struct array
Let me clarify my question. I have a struct array h1 as follows: dhash h1[10]; I want to get a Constant* to variable h1. It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this. My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1. Thanks, Chaitra ________________________________ From: Tim Northover
2014 Feb 19
2
[LLVMdev] asan coverage
I've built chromium with " -fprofile-instr-generate -fsanitize=address" -- the performance looks good! The file format from r198638 is indeed rudimentary. Do you already know how the real output format will look like? Just to summarize what I think is important: - minimal size on disk, minimal amount of files - minimal i/o while writing to disk, no lockf or some such -
2015 Jul 14
3
[LLVMdev] RFC: ThinLTO Symbol Linkage and Renaming
...ble 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 another module. Thi...
2012 Jul 23
1
[LLVMdev] static constant structs
...this >> seems overly clunky. >> >> Constant *cip = ConstantArray::get( >> ctx(), StringRef((char *)&addr_, sizeof(addr_)), false); >> return new GlobalVariable( >> *mod(), cip->getType(), true, >> GlobalVariable::PrivateLinkage, cip); >> >> In a previous version of my code, I replaced cip->getType() with the >> llvm equivalent of the type of addr_. This worked until I tried with a >> build of llvm that had assertions turned on. Even without that, I am >> hoping there is a better way to d...
2017 Apr 08
2
Getting a pointer to a i8 from a global variable that holds a constant string
...he call instruction. So far I have something like this: const std::string& str = strExpr->value(); llvm::ArrayType* type = llvm::ArrayType::get(llvm::IntegerType::get(m_context, 8), str.size()+1); llvm::GlobalVariable* var = new llvm::GlobalVariable(m_module, type, true, llvm::GlobalValue::PrivateLinkage, nullptr, ".str"); var->setAlignment(1);; llvm::Constant* c = llvm::ConstantDataArray::getString(m_context, str); var->setInitializer(c); The part below is the one I have problems with: llvm::ConstantInt* const_int32_12 = llvm::ConstantInt::get(m_context, llvm::APInt(32, llvm::St...