Wenqing Zhuang via llvm-dev
2016-Apr-20 22:49 UTC
[llvm-dev] Question on writing a machine pass of LLVM
Dear all, Hi, my name is Wenqing(Wendell) Zhuang who is a Ph.D student in the college of EECS of Syracuse University in US, I am currently writing a machine pass of LLVM which checks if a pointer points to an address that is out of a certain range. So in that pass, I need to determine if a pointer points to a stack slot or to a non-stack area(e.g heap), I call the function: X86InstrInfo::isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) in my pass which is added in X86PassConfig::addPreEmitPass(), however, that function always return 0 for every Machine Instruction, and returned FrameIndex is always 0, my pass is executed before code emit and after register allocation, but isLoadFromStackSlot and isStoreToStackSlot do not work as I expected in my pass,I can hardly figure out why. I really appreciate if anyone can help me with this. Thanks. The best! Wenqing(Wendell) Zhuang wzhuang at syr.edu Department of Electrical Engineering and Computer Science Syracuse University, US -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160420/140ed633/attachment.html>
John Criswell via llvm-dev
2016-Apr-20 23:53 UTC
[llvm-dev] Question on writing a machine pass of LLVM
On 4/20/16 6:49 PM, Wenqing Zhuang via llvm-dev wrote:> > Dear all, > > Hi, my name is Wenqing(Wendell) Zhuang who is a Ph.D student in the > college of EECS of Syracuse University in US, I am currently writing a > machine pass of LLVM which checks if a pointer points to an address > that is out of a certain range. So in that pass, I need to determine > if a pointer points to a stack slot or to a non-stack area(e.g heap), > I call the function: X86InstrInfo::isLoadFromStackSlot(const > MachineInstr *MI, int &FrameIndex) in my pass which is added in > X86PassConfig::addPreEmitPass(), however, that function always return > 0 for every Machine Instruction, and returned FrameIndex is always 0, > my pass is executed before code emit and after register allocation, > but isLoadFromStackSlot and isStoreToStackSlot do not work as I > expected in my pass,I can hardly figure out why. >Just out of curiosity, are you sure that you are running your pass after the code for the stack frame has been created (maybe that is Prologue insertion)? I'm not sure when the stack frame is created, but if memory serves correctly, it does not exist when code generation starts. Regards, John Criswell> > I really appreciate if anyone can help me with this. Thanks. The best! > > > > > > > > > > Wenqing(Wendell) Zhuang > > wzhuang at syr.edu > > Department of Electrical Engineering and Computer Science > > Syracuse University, US > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- John Criswell Assistant Professor Department of Computer Science, University of Rochester http://www.cs.rochester.edu/u/criswell -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160420/a4fdeb73/attachment-0001.html>