clang - LLVM: Get function argument locations (ABI) -
i'd write llvm plugin tell me: each function declaration, how many general purpose register, xmm register, , stack arguments function have. needs work x86 sysv calling convention. possible? if so, direction appreciated.
it's possible tricky, llvm seems more friendly when attempt manipulate ir when messing machine specific code. there's no easy way add passes, one. note eventual number of registers used depends on how virtual registers allocated real x86 logical register, spilling may occur in cases, , elimination of variables in others. you're not prevented work on ir values in ssa form, need work on last stages of codegen. make things more interesting, depends on level of optimization use. check out - llvm/lib/codegen/passes.cpp, @ addoptimizedregalloc or addfastregalloc, check out passed called inside , use last ones (implemented in separate files in codegen), hitch ride on. internal loops should pretty straight forward, you'll need run bookkeeping based on x86 target regs enumerated in targetregisterinfo
Comments
Post a Comment