similar to: How to add assembly instructions in CodeGen

Displaying 20 results from an estimated 8000 matches similar to: "How to add assembly instructions in CodeGen"

2018 May 07
2
How to add assembly instructions in CodeGen
Hello Dean, I looked at the XRay Instrumentation. That's a nice engineering effort. I am sure you had your motivation to do this in CodeGen just like I wanted to do. I don't understand all of your code but I get the idea that you are adjusting the alignment with explicit bytes and no-op instructions. My problem is also very much related to yours where my stack pointer ($rsp) alignment
2018 May 07
0
How to add assembly instructions in CodeGen
One place to look might be in the MachineOutliner target hooks in X86InstrInfo and AArch64InstrInfo. The MachineOutliner runs extremely late in the pass pipeline so it might be a good place to look for some inspiration. Of course, because this is *extremely late* it might not do *exactly* what you need. (e.g, this is post-register allocation, post frame-lowering, etc.) - Jessica > On May 4,
2018 May 07
0
How to add assembly instructions in CodeGen
On Sun, May 6, 2018 at 7:26 AM Soham Sinha via llvm-dev < llvm-dev at lists.llvm.org> wrote: > Hello, > I want to add assembly instructions at certain points in a function. This is X86 specific. So I am working in the lib/Target/X86 folder. I create a `MachineFunctionPass` in that folder. I register it in the X86TargetMachine.cpp in addPreEmitPass(). I use BuildMI to insert my own
2018 May 08
0
How to add assembly instructions in CodeGen
On Tue, May 8, 2018 at 4:06 AM Soham Sinha <soham1 at bu.edu> wrote: > Hello Dean, > I looked at the XRay Instrumentation. That's a nice engineering effort. I am sure you had your motivation to do this in CodeGen just like I wanted to do. I don't understand all of your code but I get the idea that you are adjusting the alignment with explicit bytes and no-op instructions. My
2018 May 09
1
How to add assembly instructions in CodeGen
Hi Dean, I looked at XRay. I also thought on the similar line to add assembly instructions as auxiliary template code and jump on to there. However, that may still dis-align the stack. I have to think about it. But your XRay code does give me the courage to think about this seriously. Thank you for your help. I also figured out that we can access certain CodeGen's feature right from the IR
2013 Jan 07
4
[LLVMdev] instruction scheduling issue
On 1/7/2013 2:15 PM, Xu Liu wrote: > > This would be ideal. How can I do the instrumentation pass after the > instruction scheduling? You could derive your own class from TargetPassConfig, and add the annotation pass in YourDerivedTargetPassConfig::addPreEmitPass. This will add your annotation pass very late, just before the final code is emitted. If you're using the X86 target,
2009 Aug 02
2
[LLVMdev] code-altering Passes for llc
Greetinigs, I am extending llc to include runtime checks for calls (in X86). So a call 'call target' is altered to look like this: [some check] jne error_function call target I've done this by implementing a MachineFunctionPass that is instantiated and added to the PassManager in X86TargetMachine::addPreRegAlloc. In order to create the jne-instruction I need some BasicBlock
2018 Jun 26
2
How to force an unused function declaration in clang
It does, when the function has a body. When it doesn't, it ignores <https://godbolt.org/g/2BCvht>. The body might be provided later on in the toolchain via linking a library. Regards, Soham Sinha PhD Student, Department of Computer Science Boston University On Tue, Jun 26, 2018 at 10:25 AM Hans Wennborg <hans at chromium.org> wrote: > It works for me: > >
2018 Jun 26
2
How to force an unused function declaration in clang
For the same reason GCC allowed the attribute. Even if I want to use/inline a function later on in the pipeline. Regards, Soham Sinha PhD Student, Department of Computer Science Boston University On Tue, Jun 26, 2018 at 8:30 AM mayuyu.io <admin at mayuyu.io> wrote: > Out of curiosity, how does an unused declaration affect the emitted object > file > > Zhang > > > 在
2016 Sep 05
2
How to insert instructions before each function calls?
We do something very similar here for XRay, and I would think the approach would be similar. What XRay does are the following: - Find the machine instructions in a MachineFunctionPass that look interesting from the XRay perspective. Theses turn out to be: the beginning of the function (not really an instruction but a location), tail calls, and returns. I suspect you can very simply find the call
2018 Jun 26
2
How to force an unused function declaration in clang
clang doesn't seem to respect __attribute__((used)) in C functions. Even if I declare a function like the following: __attribute__((used)) void function(), then also it doesn't declare the function in its IR file if I don't use the function. Is there any other way to force the declaration of "unused" function declarations with clang. I have hacked in clang 6.0.0 in
2018 May 15
3
How to inline function from other file in IR
Hello, How can I inline a function mentioned in other file? I have an inline function *foo* in C source file (a.c) which is not referenced in this file. I compile this file to a.ll (I notice that the compiled a.ll doesn't have *foo*'s definition, probably because it was inlined but not called anywhere) I have another C source file b.c with function *bar*; I compile this to b.ll I link
2015 Oct 22
2
add intrinsic function support for customized backend
Hi, All, I want to add one intrinsic function for my particular backend. Let's say the intrinsic function is named "foo" which takes two i32 inputs and has one i32 output. First, I add this line "def int_foo : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrReadArgMem]>;" in /include/llvm/IR/Intrinsics.td. Then, in my target/InstrInfo.td, I'm supposed
2018 May 10
2
Assembly file compilation flow
Hello, LLVM MC blog post <http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html> explains fairly well how the backend MC project is working. However, it's not clear to me how LLVM converts an assembly file (.s) to an object file. The driver --verbose option is not giving me much information as well. I want to know the flow. Like, What CodeGen phases does this file pass through? Is
2018 Jun 25
2
How to include a opt pass in clang driver
Hi Eli, I have tried that: static void registerMyPass(const PassManagerBuilder &, llvm::legacy::PassManagerBase &PM) { PM.add(new MyPass()); } static RegisterStandardPasses RegisterMyPass(PassManagerBuilder::EP_OptimizerLast, registerMyPass); It still couldn't find my pass. Regards, Soham Sinha PhD Student,
2016 Sep 04
1
How to insert instructions before each function calls?
On Sun, Sep 4, 2016 at 7:44 AM, Ryan Taylor <ryta1203 at gmail.com> wrote: > Mehdi, > > Sorry, I misread his original post. > > So something like: > > XXXInsrtInfo *XII; // target instruction info > MachineBasicBlock::iterator MI = MachineBasicBlock(YourCallInst); > MachineBasicBlock *MBB = YourCallInst->getParent(); // basic block > location of
2018 May 17
1
How to inline function from other file in IR
Hi Soham, “extern inline” keyword will help in this case, with this keyword compiler is forced to keeps the definition of the function and make it available for the external usage. Also it retains the “inlinehint” attribute on the function, with that lto inliner may make it inline. Best, Ashutosh From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Mehdi AMINI via llvm-dev
2018 Jun 25
2
How to include a opt pass in clang driver
Hello, I have written a pass for the IR and I can run it with opt -load lib/LLVMMyPass.so -mypass -myarguments -S -o output.ll < output.bc I have registered my pass with the following code: static RegisterPass<MyPass> X("mypass", "MyPass Pass (with getAnalysisUsage implemented)"); How do I include the same pass in the clang driver. I tried running the pass: clang
2015 Nov 04
3
Confused on how to do a machinefunction pass
Thank you so much. That helped alot. Fami On Wed, Nov 4, 2015 at 9:40 AM, John Criswell <jtcriswel at gmail.com> wrote: > On 11/3/15 7:54 PM, fateme Hoseini wrote: > > Dear John, > Thank you so much for your help. I looked at those documents. Could you > kindly answer the following questions: > > Does it mean that I have to make my own backend target in order to write
2018 May 17
0
How to inline function from other file in IR
Hi Soham, Are you intending to use the inline keyword in order to control the inlining optimization? The inline keyword is not doing this, it is changing the linkage type of the symbol and instruct the compiler to discard it if there is no call left, and also will instruct the linker to deduplicate. For instance if multiple file include a header that defines an inline function, this function