Hi!> diff --git a/lib/CodeGen/StackSegmenter.cpp b/lib/CodeGen/StackSegmenter.cpp > new file mode 100644 > index 0000000..5ffb8f2 > --- /dev/null > +++ b/lib/CodeGen/StackSegmenter.cpp > @@ -0,0 +1,48 @@ > +//===-- StackSegmenter.h - Prolog/Epilog code insertion -------*- C++ -* --===// > > The comment is obviously incorrect.Thanks. So much for lifting file headers. :)> > diff --git a/lib/CodeGen/StackSegmenter.h b/lib/CodeGen/StackSegmenter.h > new file mode 100644 > index 0000000..1284532 > --- /dev/null > +++ b/lib/CodeGen/StackSegmenter.h > @@ -0,0 +1,43 @@ > +//===-- StackSegmenter.h - Prolog/Epilog code insertion -------*- C++ -* --===// > > Please write comment that clearly indicates what the pass would do.Will do.> A bigger question is why is StackSegmenter.{h|cpp} are for? It's empty as far as I can tell.In the `Prologue code emission for X86.', I modify this pass to emit segmented stacks code before function prologues (by calling a function in X86FrameLowering). I organized the code this way since it seemed more elegant than checking for a flag inside the corresponding emitPrologue. -- Sanjoy Das http://playingwithpointers.com
On Aug 23, 2011, at 9:24 AM, Sanjoy Das wrote:> Hi! > >> diff --git a/lib/CodeGen/StackSegmenter.cpp b/lib/CodeGen/StackSegmenter.cpp >> new file mode 100644 >> index 0000000..5ffb8f2 >> --- /dev/null >> +++ b/lib/CodeGen/StackSegmenter.cpp >> @@ -0,0 +1,48 @@ >> +//===-- StackSegmenter.h - Prolog/Epilog code insertion -------*- C++ -* --===// >> >> The comment is obviously incorrect. > > Thanks. So much for lifting file headers. :) > >> >> diff --git a/lib/CodeGen/StackSegmenter.h b/lib/CodeGen/StackSegmenter.h >> new file mode 100644 >> index 0000000..1284532 >> --- /dev/null >> +++ b/lib/CodeGen/StackSegmenter.h >> @@ -0,0 +1,43 @@ >> +//===-- StackSegmenter.h - Prolog/Epilog code insertion -------*- C++ -* --===// >> >> Please write comment that clearly indicates what the pass would do. > > Will do. > >> A bigger question is why is StackSegmenter.{h|cpp} are for? It's empty as far as I can tell. > > In the `Prologue code emission for X86.', I modify this pass to emit > segmented stacks code before function prologues (by calling a function > in X86FrameLowering). I organized the code this way since it seemed > more elegant than checking for a flag inside the corresponding > emitPrologue.According to the patch you send, the pass is not doing anything: +bool StackSegmenter::runOnMachineFunction(MachineFunction &MF) { + return false; +} + Evan> > -- > Sanjoy Das > http://playingwithpointers.com
Hi!> According to the patch you send, the pass is not doing anything: > > +bool StackSegmenter::runOnMachineFunction(MachineFunction &MF) { > + return false; > +} > +It is, in the next patch. diff --git a/lib/CodeGen/StackSegmenter.cpp b/lib/CodeGen/StackSegmenter.cpp index 5ffb8f2..cc2ca87 100644 --- a/lib/CodeGen/StackSegmenter.cpp +++ b/lib/CodeGen/StackSegmenter.cpp @@ -40,7 +40,10 @@ void StackSegmenter::getAnalysisUsage(AnalysisUsage &info) const { } bool StackSegmenter::runOnMachineFunction(MachineFunction &MF) { - return false; + const TargetFrameLowering &TFI = *MF.getTarget().getFrameLowering(); + TFI.adjustForSegmentedStacks(MF); + // adjustForSegmentedStacks always changes the MachineFunction + return true; } FunctionPass *llvm::createStackSegmenter() { -- Sanjoy Das http://playingwithpointers.com