[llvm-commits] [llvm] r138812 - in /llvm/trunk: include/llvm/Target/TargetFrameLowering.h lib/CodeGen/PrologEpilogInserter.cpp lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86FrameLowering.h lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86MachineFunctionInfo.h

Duncan Sands baldrick at free.fr
Tue Aug 30 23:33:46 PDT 2011


Hi Rafael,

> --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Tue Aug 30 14:39:58 2011
> @@ -29,6 +29,7 @@
>   #include "llvm/CodeGen/MachineRegisterInfo.h"
>   #include "llvm/CodeGen/RegisterScavenging.h"
>   #include "llvm/Target/TargetMachine.h"
> +#include "llvm/Target/TargetOptions.h"
>   #include "llvm/Target/TargetRegisterInfo.h"
>   #include "llvm/Target/TargetFrameLowering.h"
>   #include "llvm/Target/TargetInstrInfo.h"
> @@ -699,6 +700,13 @@
>       if (!I->empty()&&  I->back().getDesc().isReturn())
>         TFI.emitEpilogue(Fn, *I);
>     }
> +
> +  // Emit additional code that is required support segmented stacks, if we've

required support -> required to support

> +  // been asked for it.  This, when linked with a runtime with support for
> +  // segmented stacks (libgcc is one), will result allocating stack space in
result allocating -> result in allocating

> +static unsigned
> +GetScratchRegister(bool Is64Bit, const MachineFunction&MF) {
> +  if (Is64Bit) {
> +    return X86::R11;
> +  } else {
> +    CallingConv::ID CallingConvention = MF.getFunction()->getCallingConv();
> +    bool IsNested = HasNestArgument(&MF);
> +
> +    if (CallingConvention == CallingConv::X86_FastCall) {
> +      if (IsNested) {
> +        report_fatal_error("Segmented stacks does not supprot fastcall with "

supprot -> support

> +                           "nested fucntion.");

fucntion -> function

> +        return -1;
> +      } else {
> +        return X86::EAX;
> +      }
> +    } else {
> +      if (IsNested)
> +        return X86::EDX;
> +      else
> +        return X86::ECX;
> +    }
> +  }
> +}

Ciao, Duncan.



More information about the llvm-commits mailing list