search for: addattribute

Displaying 20 results from an estimated 42 matches for "addattribute".

2013 Mar 13
0
[LLVMdev] attributes helper functions - please review
...+++ include/llvm/IR/Function.h (working copy) @@ -181,6 +181,14 @@ AttributeSet::FunctionIndex, N)); } + /// addFnAttr - Add function attributes to this function. + /// + void addFnAttr(StringRef Kind) { + setAttributes( + AttributeSets.addAttribute(getContext(), + AttributeSet::FunctionIndex, Kind)); + } + /// \brief Return true if the function has the attribute. bool hasFnAttribute(Attribute::AttrKind Kind) const { return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind); Index: include...
2016 Nov 17
3
DWARF Generator
...t;); StringRef Path("/tmp/test.elf"); bool DwarfInitSuccess = DG.init(Triple, Path); EXPECT_TRUE(DwarfInitSuccess); uint16_t Version = 4; uint8_t AddrSize = 8; DwarfGenCU &CU = DG.appendCompileUnit(Version, AddrSize); DwarfGenDIE CUDie = CU.getUnitDIE(); CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); DwarfGenDIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main"); SubprogramDie.addAttribute(DW_AT_low_...
2017 Aug 24
2
How do set 'nest' addribute in an indirect call?
...17 09:40 AM, Tim Northover wrote: > On 17 August 2017 at 15:15, Rodney M. Bates via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> For an indirect call, i.e., on a function whose address is runtime variable, >> I can't find any place/way to attach this attribute. LLVMAddAttribute >> won't take a type. > > In the C++ API you'd add the attribute to the CallInst. I've not used > any of the wrappers, but I think you might get what you want via > LLVMAddCallSiteAttribute. I don't find LLVMAddCallSiteAttribute or anything similar in include/llvm...
2016 Nov 18
4
DWARF Generator
...lf"); > bool DwarfInitSuccess = DG.init(Triple, Path); > EXPECT_TRUE(DwarfInitSuccess); > uint16_t Version = 4; > uint8_t AddrSize = 8; > DwarfGenCU &CU = DG.appendCompileUnit(Version, AddrSize); > DwarfGenDIE CUDie = CU.getUnitDIE(); > > CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); > CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); > > DwarfGenDIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); > SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main"); > SubprogramDi...
2011 Aug 19
2
[LLVMdev] How to halt a program
...; <i32> [#uses=1] ret i32 %retval1 } So, what is the LLVM code to insert the call "call void @exit(i32 1) noreturn nounwind"? I thought about something like: CallInst *abort = CallInst::Create(/*POINTER TO ABORT*/, ArrayRef<Value*>(), Twine(), assertfail); abort->addAttribute(~0, Attribute::NoReturn); abort->addAttribute(~0, Attribute::NoUnwind); However, I do not know what to fill up in /*POINTER TO ABORT*/. Can anyone help me? Thank you very much, Victor -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pip...
2016 Nov 18
2
DWARF Generator
...(Triple, Path); >>> EXPECT_TRUE(DwarfInitSuccess); >>> uint16_t Version = 4; >>> uint8_t AddrSize = 8; >>> DwarfGenCU &CU = DG.appendCompileUnit(Version, AddrSize); >>> DwarfGenDIE CUDie = CU.getUnitDIE(); >>> >>> CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); >>> CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); >>> >>> DwarfGenDIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); >>> SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main...
2016 Nov 18
2
DWARF Generator
...EXPECT_TRUE(DwarfInitSuccess); > >>> uint16_t Version = 4; > >>> uint8_t AddrSize = 8; > >>> DwarfGenCU &CU = DG.appendCompileUnit(Version, AddrSize); > >>> DwarfGenDIE CUDie = CU.getUnitDIE(); > >>> > >>> CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); > >>> CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); > >>> > >>> DwarfGenDIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); > >>> SubprogramDie.addAttribute(DW_AT_name, DW_FO...
2011 Aug 19
0
[LLVMdev] How to halt a program
...32 %retval1 > } > > So, what is the LLVM code to insert the call "call void @exit(i32 1) > noreturn nounwind"? I thought about something like: > > CallInst *abort = CallInst::Create(/*POINTER TO ABORT*/, > ArrayRef<Value*>(), Twine(), assertfail); > abort->addAttribute(~0, Attribute::NoReturn); > abort->addAttribute(~0, Attribute::NoUnwind); > > However, I do not know what to fill up in /*POINTER TO ABORT*/. Can > anyone help me? Something like: // Once, M = llvm::Module*, C = LLVMContext&: FunctionType *AbortFTy = FunctionType::get(Type::get...
2019 Feb 22
2
Create the GlobalVariable which have extern in one header file
...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 must have a zero initializer! [10 x i8*]* @DATA_TABLE.1 LLVM ERROR: Broken module fou...
2011 Sep 01
1
[LLVMdev] How to halt a program
...y(*context), false); Function *AbortF = Function::Create(AbortFTy, GlobalValue::ExternalLinkage, "abort", &M); // Call to abort function CallInst *abort = CallInst::Create(AbortF, Twine(), assertfail); // Add atributes to the abort call instruction: no return and no unwind abort->addAttribute(~0, Attribute::NoReturn); abort->addAttribute(~0, Attribute::NoUnwind); // Unreachable instruction new UnreachableInst(*context, assertfail); So, my bytecode now looks like this one below: define i32 @main() nounwind { .... "assert fail": ; preds =...
2019 Feb 22
1
Create the GlobalVariable which have extern in one header file
...]* @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->setAlignment(16); gNew->setSection("data_section"); gNew->addAttrib...
2013 May 15
2
[LLVMdev] Attributes & CloneFunctionInto
...g. removing all attributes from the target declaration, then cloning, and then setting the correct attributes. However, I can't find a way to modify an existing alignment *in any way* without hitting an assertion (the other one being line 727 for removeAttributes). I've also tried using addAttributes() and setAttributes() to set the alignment to 0, but this seems to be ignored... Any help on this? :) Thanks, Ralf
2016 Dec 30
3
Avoiding during my pass the optimization (copy propagation) of my LLVM IR code (at generation)
...CreateGEP(ptr_B, vecShuffleOne, "VectorGep"); ... packed_gather_params.push_back(vecShuffleOnePtr); CallInst *callGather = Builder.CreateCall(func_llvm_masked_gather_v128i16, packed_gather_params); callGather->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); DEBUG(dbgs() << "callGather: " << *callGather << "\n"); When running this code we get at stderr something like: callgather: %50 = call <4 x i16> @llvm.masked.gather.v4i16(<4 x i1...
2015 Jul 13
2
[LLVMdev] String attributes for function arguments and return values
...nd return values. We are going to use them in our tree to express higher level language types. Internally attributes framework have everything to do this, it’s even possible to generate string attributes via API right now: Function *function; function->setAttributes(function->getAttributes().addAttribute(context, i, "attribute")); But because it’s not supported in LLParser if you dump the function and try to parse it back it will fail. I have a patch to fix this problem: http://reviews.llvm.org/D11058 I consider this part as a bug fix for existing functionality. The second patch is to ad...
2017 Aug 17
3
How do set 'nest' addribute in an indirect call?
...re.h' binding) 1) Build a function type, using LLVMFunctionType. 2) Build a function value, passing the result of 1) to LLVMAddFunction 3) Go through the formal parameters of 2), using LLVMGet[First|Next]Param, which give me a value for each formal 4) For the desired formal, pass it to LLVMAddAttribute. This results in compiled code that passes my parameter in the same way as gcc, giving the interoperability I need. For an indirect call, i.e., on a function whose address is runtime variable, I can't find any place/way to attach this attribute. LLVMAddAttribute won't take a type. I don...
2011 Jan 01
3
[LLVMdev] misaligned_stack_error caused by LLVM code on MacOS: how to fix?
llvm-generated code that runs fine on linux/i386 causes EXC_BAD_ACCESS with misaligned_stack_error_ on MacOS/i386. I read online that each function should have stack aligned by 16 on MacOS/i386 and such code should be used: Fn->addAttribute(~0U, llvm::Attribute::constructStackAlignmentFromInt(16)); But when I run clang on some C++ code I don't see alignstack instructions generated at all. What is the right way for fix this misaligned_stack_error? Yuri
2015 Mar 24
2
[LLVMdev] Propagate clang attribute to IR
...t without any luck: static void handleOBF(Sema &S, Decl *D, const AttributeList &Attr) { D->addAttr(::new (S.Context)NoFLAAttr(Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex())); // ??????????? llvm::AttrBuilder FuncAttrs; FuncAttrs.addAttribute(); } In CodeGenModule::ConstructAttributeList it uses a AttrBuilder, I tried there to add a random attribute and it works. But I’m not understanding how to do that in SemaDeclAttr.cpp. Cheers
2013 May 15
0
[LLVMdev] Attributes & CloneFunctionInto
...ributes from the target declaration, then cloning, and then setting > the correct attributes. > However, I can't find a way to modify an existing alignment *in any > way* without hitting an assertion (the other one being line 727 for > removeAttributes). I've also tried using addAttributes() and > setAttributes() to set the alignment to 0, but this seems to be > ignored... SAFECode clones a function to change the alignment of byval arguments. You can look at the code at http://llvm.org/viewvc/llvm-project/safecode/branches/release_32/lib/BaggyBoundsChecks/BaggyBoundsChec...
2019 Jan 04
2
[RFC] Adding a -memeq-lib-function flag to allow the user to specify a memeq function.
Thanks for the suggestions Hal, So if I understand correctly, you're recommending we add a module flag <https://llvm.org/docs/LangRef.html#module-flags-metadata> to LLVM, something like: !llvm.module.flags = !{..., !123} !123 = !{i32 1, !"memeq_lib_function", !"user_memeq"} I've given it a try in the following patch: https://reviews.llvm.org/D56311 If this
2015 Jul 13
2
[LLVMdev] String attributes for function arguments and return values
...on’t think that these attributes will require any special handling. Artur Thanks again, Hal Internally attributes framework have everything to do this, it’s even possible to generate string attributes via API right now: Function *function; function->setAttributes(function->getAttributes().addAttribute(context, i, "attribute")); But because it’s not supported in LLParser if you dump the function and try to parse it back it will fail. I have a patch to fix this problem: http://reviews.llvm.org/D11058 I consider this part as a bug fix for existing functionality. The second patch is to ad...