search for: setalignment

Displaying 20 results from an estimated 81 matches for "setalignment".

Did you mean: getalignment
2015 Mar 05
4
[LLVMdev] global variable
Hi all, I am newbie for llvm. I just create a global variable, there are some statements in my pass like: LoadInst* int64_64 = new LoadInst(pthreadPID, "", false, OptAplusOne); int64_64->setAlignment(8); int64_64->dump(); LoadInst* int32_65 = new LoadInst(gvar_int32_myFlag, "", false, OptAplusOne); int32_65->setAlignment(4); int32_65->dump(); But when I run my pass, it generates an error, I don't know why. @myFlag = global i32 0, align 4 @myPid = comm...
2008 Jul 10
1
[LLVMdev] InstructionCombining forgets alignment of globals
On Thursday 10 July 2008 07:46, Nicolas Capens wrote: > Hi Duncan, > > I see. I didn't know GlobalValue had a method for changing the alignment > (and that 0 meant natural alignment). Explicitly calling setAlignment works > like a charm. Nicolas, Where are you explicitly calling setAlignment? From llvm-gcc code? -Dave
2017 May 22
2
How exactly is datatype alignment determined?
The 8 in the data layout string should have been converted to a byte value by this code before it was passed to setAlignment. As far as I cant ell getAlignment should return the byte alignment that was passed to setAlignment, not the bit alignment from the string. // ABI alignment. if (Rest.empty()) report_fatal_error( "Missing alignment specification in datalayout string");...
2011 Aug 19
1
[LLVMdev] LLVM: Very simple question
Hi, guys. I'm a newbie to LLVM and have a very simple question. Which instructions should I use (in terms of IRBuilder calls) to allocate an array of bytes in stack (alloca?), then to work with it (from a given offset) as with integer (bitcast?). I mean something like that: unsigned char var[8]; unsigned int offset = 3; int val = *(int*)(&var+offset); /* read */ *(int*)(&var+offset)
2019 Feb 22
2
Create the GlobalVariable which have extern in one header file
..._TABLE[]; And with a LLVM PASS, I am trying to create this array with the same name and with initializer. So, I have following: GlobalVariable *gvar_data = new GlobalVariable( M, blockItems->getType(), true, GlobalValue::CommonLinkage, blockItems, "DATA_TABLE"); gvar_data->setAlignment(16); gvar_data->setSection("data_section"); gvar_data->addAttribute(llvm::Attribute::OptimizeNone); I am not sure if I am using the correct Linkage or not. The pass has failed to complete it. Here is the runtime fault. Any guess what I am doing incorrect? 'common' global m...
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...g1 = new GlobalVariable( *F->getParent(), s1Ty, true, GlobalValue::PrivateLinkage, 0, ""); g1->setAlignment(1); g2 = new GlobalVariable( *F->getParent(), s2Ty, true, GlobalValue::PrivateLinkage, 0, "");...
2010 Mar 09
3
[LLVMdev] Alignment for Alloca Inst in llvm 2.6
...; <i32*> [#uses=1] %0 = call i8* @handle_args(i32 %argc, i8** %argv) ; <i8*> [#uses=1] %argv_temp = bitcast i8* %0 to i8** ; <i8**> [#uses=1] %a = alloca [100 x i32], align 512 ; <[100 x i32]*> [#uses=2] 2. I notice that the setAlignment method for an AllocaInst takes an unsigned. For 64 bit systems, alignment could potentially be larger. Is there a reason why the alignment should be restricted to this size? Thanks in advance Arushi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.l...
2008 Jul 10
2
[LLVMdev] InstructionCombining forgets alignment of globals
Hi Nicolas, > if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) { > > unsigned Align = GV->getAlignment(); > > if (Align == 0 && TD && GV->getType()->getElementType()->isSized()) > > Align = TD->getPrefTypeAlignment(GV->getType()->getElementType()); > > It assumes that global values are always optimally
2008 Jul 10
0
[LLVMdev] InstructionCombining forgets alignment of globals
Hi Duncan, I see. I didn't know GlobalValue had a method for changing the alignment (and that 0 meant natural alignment). Explicitly calling setAlignment works like a charm. So it's not an LLVM bug. Thanks, Nicolas -----Original Message----- From: Duncan Sands [mailto:baldrick at free.fr] Sent: Thursday, 10 July, 2008 14:41 To: llvmdev at cs.uiuc.edu Cc: Nicolas Capens Subject: Re: [LLVMdev] InstructionCombining forgets alignment of global...
2019 Feb 22
1
Create the GlobalVariable which have extern in one header file
...6 #0 In my uses: %arrayidx = getelementptr inbounds [0 x i8*], [0 x i8*]* @DATA_TABLE, i64 0, i64 %3 Why it is creating another global variable instead of linking? Is that because of array size mismatch? Here is my code: GlobalVariable *old = M.getGlobalVariable("DATA_TABLE"); old->setAlignment(16); old->setSection("data_section"); old->addAttribute(llvm::Attribute::OptimizeNone); old->setDSOLocal(false); GlobalVariable *gNew = new GlobalVariable( M, blockItems->getType(), false, GlobalValue::ExternalLinkage, blockItems, "DATA_TABLE"); gNew->setAlignmen...
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...;getParent(), > s1Ty, > true, > GlobalValue::PrivateLinkage, > 0, > ""); > g1->setAlignment(1); > > g2 = new GlobalVariable( *F->getParent(), > s2Ty, > true, > GlobalValue::PrivateLinkage, > 0, >...
2007 Nov 07
3
[LLVMdev] RFC: llvm-convert.cpp Patch
..._align(exp) / 8; if (!LV.isBitfield()) { if (!DestLoc) { @@ -2548,17 +2549,17 @@ Value *Ptr = CastToType(Instruction::BitCast, LV.Ptr, PointerType::get(Ty)); LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile, "tmp"); - LI->setAlignment(Alignment); + LI->setAlignment(DstAlign); return LI; } else { EmitAggregateCopy(DestLoc, LV.Ptr, TREE_TYPE(exp), false, isVolatile, - Alignment); + std::min(DstAlign, SrcAlign)); return 0; } } else {...
2015 Mar 10
3
[LLVMdev] Chatty C++API code generation
...es.push_back(const_int32_104); Constant* const_ptr_113 = ConstantExpr::getGetElementPtr(gvar_struct_adam, const_ptr_113_indices); //here we have const_ptr_113; why not use it in theCallInst? LoadInst* float_130 = new LoadInst(const_ptr_113, "", false, label_entry_121); float_130->setAlignment(4); CallInst* float_call = CallInst::Create(func__Z4fib3f, float_130, "call", label_entry_121); ------------------------------------------------ To me, this ll code seems to relate to something like int main() { float localfloat=foo.weight; callAFunction(localfloat); This is d...
2012 Aug 22
1
[LLVMdev] Insert Self Written Function Call from a FunctionPass?
...aInst* count; namespace{ struct bishe_insert : public FunctionPass{ static char ID; bishe_insert() : FunctionPass(ID) {} virtual bool runOnFunction(Function &func) { count = new AllocaInst(IntegerType::getInt32Ty(Context), 0, "count"); count->setAlignment(4); for(Function::iterator F = func.begin(), E = func.end(); F!= E; ++F) { if(F == func.begin()) { bishe_insert::insertOnFirstBlock(F); } bishe_insert::runOnBasicBlock(F); } return false; } /*insert alloca instruc...
2019 Jan 29
2
[cfe-dev] Create a BlockAddress array from LLVM Pass
...able( > > /*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::getScalarTy > > > > Can anyone suggest what I suppose to do? It is definitely re...
2010 Oct 24
2
[LLVMdev] lli : external functions and target datalayout
...get datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" If I use this string to creat a TargetData object directly, I got an assertion error: ~/llvm-2.6/lib/Target/TargetData.cpp:246: void llvm::TargetData::setAlignment(llvm::AlignTypeEnum, unsigned char, unsigned char, uint32_t): Assertion `abi_align <= pref_align && "Preferred alignment worse than ABI!"' failed. Aborted This is because of the i64:32:64. It seems to be i64:64:64. 'lli' is able to fix this problem automatically, b...
2015 Mar 07
2
[LLVMdev] cannot understand global c++API code
...98); const_ptr_103_indices.push_back(const_int32_99); Constant* const_ptr_103 = ConstantExpr::getGetElementPtr(gvar_struct_foo, const_ptr_103_indices); //the store inst is in principle clear StoreInst* void_119 = new StoreInst(const_float_102, const_ptr_103, false, label_entry_113); void_119->setAlignment(4); --------------------------------------------- comment: I don't get whats the meaning of the two const_int32 (98 & 99 above) and why the const_ptr_103 should relate the foo.weight field of the stest struct. Any hint appreciated! Alex
2007 Nov 07
0
[LLVMdev] RFC: llvm-convert.cpp Patch
On Nov 6, 2007, at 5:45 PM, Bill Wendling wrote: > Hi all, > > This patch is to fix a problem on PPC64 where an unaligned memcpy is > generated. The testcase is this: > > $ cat testcase.c > void Qux() { > char Bar[11] = {0}; > } > > What happens is that we produce LLVM code like this: > > call void @llvm.memcpy.i64( i8* %event_list2, i8* getelementptr ([11
2019 Jan 28
2
Create a BlockAddress array from LLVM Pass
...b); 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::getScalarTy Can anyone suggest what I suppose to do? It is definitely related to my type declaration and BlockAddress ite...
2009 Jun 03
1
[LLVMdev] RFA: Alignment of Strings
...n 72733) +++ llvm-gcc.src/gcc/llvm-convert.cpp (working copy) @@ -7418,6 +7418,8 @@ TAI ? TAI->getStringConstantPrefix() : ".str", TheModule); + GV->setAlignment(TYPE_ALIGN(TREE_TYPE(exp))); + if (SlotP) *SlotP = GV; #ifdef LLVM_CSTRING_SECTION // For Darwin, try to put it into the .cstring section.