[llvm-commits] [llvm] r138818 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86ISelLowering.h

Duncan Sands baldrick at free.fr
Tue Aug 30 23:57:09 PDT 2011


Hi Rafael,

> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Aug 30 14:47:04 2011
> @@ -8844,8 +8846,10 @@
>   SDValue
>   X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
>                                              SelectionDAG&DAG) const {
> -  assert((Subtarget->isTargetCygMing() || Subtarget->isTargetWindows())&&
> -         "This should be used only on Windows targets");
> +  assert((Subtarget->isTargetCygMing() || Subtarget->isTargetWindows() ||
> +          EnableSegmentedStacks)&&
> +         "This should be used only on Windows targets or when segmented stacks "
> +         "are being used.");

It's not usual to have a full stop at the end of assertion messages.

>     assert(!Subtarget->isTargetEnvMacho());

Here there should be a message if the assertion fails.

>     DebugLoc dl = Op.getDebugLoc();
>
> @@ -8854,23 +8858,49 @@
>     SDValue Size  = Op.getOperand(1);
>     // FIXME: Ensure alignment here
>
> -  SDValue Flag;
> +  bool Is64Bit = Subtarget->is64Bit();
> +  EVT SPTy = Is64Bit ? MVT::i64 : MVT::i32;
>
> -  EVT SPTy = Subtarget->is64Bit() ? MVT::i64 : MVT::i32;
> -  unsigned Reg = (Subtarget->is64Bit() ? X86::RAX : X86::EAX);
> +  if (EnableSegmentedStacks) {
> +    MachineFunction&MF = DAG.getMachineFunction();
> +    MachineRegisterInfo&MRI = MF.getRegInfo();
>
> -  Chain = DAG.getCopyToReg(Chain, dl, Reg, Size, Flag);
> -  Flag = Chain.getValue(1);
> +    if (Is64Bit) {
> +      // The 64 bit implementation of segmented stacks needs to clobber both r10
> +      // r11. This makes it impossible to use it along with nested paramenters.

paramenters -> parameters

What are the restrictions on using segmented stacks with nested functions
exactly?  Hopefully the implementation can fully support Go.  Does GCC have
the same restrictions?

> +      const Function *F = MF.getFunction();
> +
> +      for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
> +           I != E; I++)
> +        if (I->hasNestAttr())
> +          report_fatal_error("Cannot use segmented stacks with functions that "
> +                             "have nested arguments.");
> +    }

Ciao, Duncan.



More information about the llvm-commits mailing list