Displaying 2 results from an estimated 2 matches for "gv_alignment_compar".
2016 Jul 27
2
help please: how to sort the contents of a "SymbolTableListTraits<GlobalVariable>"?
....)" was not usable to solve the problem].
BTW: I am [and was] doing this in the context of "OptimizeGlobalVars" which is in
"llvm/lib/Transforms/IPO/GlobalOpt.cpp".
If anybody reading this can provide some assistance, I`d be much obliged.
Regards,
Abe
struct GV_alignment_comparator {
bool operator()(const GlobalVariable& L, const GlobalVariable& R) {
return L.getAlignment() < R.getAlignment();
}
};
// 'M' is a "Module &"
/* this crashes BADLY... :-(
M.getGlobalList().sort( GV_alignment_comparator() );
Change...
2016 Aug 04
4
help please: how to sort the contents of a "SymbolTableListTraits<GlobalVariable>"?
...ogram-under-compilation to make this fail. As before, I will
paste something in after my sign-off.
Regards,
Abe
----- added near the end of "OptimizeGlobalVars" in "llvm/lib/Transforms/IPO/GlobalOpt.cpp",
amongst many other things I added to that routine -----
struct GV_alignment_comparator {
bool operator()(const GlobalVariable& L, const GlobalVariable& R) {
return L.getAlignment() < R.getAlignment();
}
};
if (unsorted) {
M.getGlobalList().sort( GV_alignment_comparator() );
Changed = true;
}
----- added to "llvm/lib/IR/Globals.cpp" [...