[llvm-commits] [llvm] r96601 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp

Chris Lattner clattner at apple.com
Tue Feb 23 10:37:44 PST 2010


On Feb 18, 2010, at 10:51 AM, Dale Johannesen wrote:

> Author: johannes
> Date: Thu Feb 18 12:51:15 2010
> New Revision: 96601
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=96601&view=rev
> Log:
> Generate DBG_VALUE from dbg.value intrinsics.  These currently
> comes out as comments but will eventually generate DWARF.
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Feb 18 12:51:15 2010
> @@ -1161,10 +1161,41 @@
>     if (!X86SelectAddress(DI->getAddress(), AM))
>       return false;
>     const TargetInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
> +    // FIXME may need to add RegState::Debug to any registers produced,
> +    // although ESP/EBP should be the only ones at the moment.
>     addFullAddress(BuildMI(MBB, DL, II), AM).addImm(0).
>                                         addMetadata(DI->getVariable());
>     return true;
>   }
> +  case Intrinsic::dbg_value: {
> +    // FIXME this should eventually be moved to FastISel, when all targets
> +    // are able to cope with DBG_VALUE.  There is nothing target dependent here.

Dale, X86 is the only target that uses fastisel, you might as well move this up right now.

-Chris

> +    DbgValueInst *DI = cast<DbgValueInst>(&I);
> +    const TargetInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
> +    Value *V = DI->getValue();
> +    if (!V) {
> +      // Currently the optimizer can produce this; insert an undef to
> +      // help debugging.  Probably the optimizer should not do this.
> +      BuildMI(MBB, DL, II).addReg(0U).addImm(DI->getOffset()).
> +                                     addMetadata(DI->getVariable());
> +    } else if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
> +      BuildMI(MBB, DL, II).addImm(CI->getZExtValue()).addImm(DI->getOffset()).
> +                                     addMetadata(DI->getVariable());
> +    } else if (ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
> +      BuildMI(MBB, DL, II).addFPImm(CF).addImm(DI->getOffset()).
> +                                     addMetadata(DI->getVariable());
> +    } else if (unsigned Reg = lookUpRegForValue(V)) {
> +      BuildMI(MBB, DL, II).addReg(Reg, RegState::Debug).addImm(DI->getOffset()).
> +                                     addMetadata(DI->getVariable());
> +    } else {
> +      // We can't yet handle anything else here because it would require
> +      // generating code, thus altering codegen because of debug info.
> +      // Insert an undef so we can see what we dropped.
> +      BuildMI(MBB, DL, II).addReg(0U).addImm(DI->getOffset()).
> +                                     addMetadata(DI->getVariable());
> +    }     
> +    return true;
> +  }
>   case Intrinsic::trap: {
>     BuildMI(MBB, DL, TII.get(X86::TRAP));
>     return true;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list