[llvm-commits] [llvm] r93499 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86MCInstLower.cpp X86RegisterInfo.cpp
Chris Lattner
clattner at apple.com
Thu Jan 14 20:28:03 PST 2010
On Jan 14, 2010, at 5:54 PM, Dale Johannesen wrote:
> Author: johannes
> Date: Thu Jan 14 19:54:55 2010
> New Revision: 93499
>
> URL: http://llvm.org/viewvc/llvm-project?rev=93499&view=rev
> Log:
> Lower FrameIndex operand of DEBUG_VALUE (specially) and
> print it as a comment on X86.
Hi Dale,
Like GC_LABEL, I think this should just call a method on the parent asmprinter class (like printLabel) so that this can be implemented in target-independent code. The target independent code can just print it as "FI#4" it doesn't necessarily have to resolve it to "%esp+127"
-Chris
>
>
> Modified:
> llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
> llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>
> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=93499&r1=93498&r2=93499&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Thu Jan 14 19:54:55 2010
> @@ -25,6 +25,7 @@
> #include "llvm/Support/FormattedStream.h"
> #include "llvm/Support/Mangler.h"
> #include "llvm/ADT/SmallString.h"
> +#include "llvm/Analysis/DebugInfo.h"
> using namespace llvm;
>
>
> @@ -420,6 +421,25 @@
> case TargetInstrInfo::GC_LABEL:
> printLabel(MI);
> return;
> + case TargetInstrInfo::DEBUG_VALUE: {
> + if (!VerboseAsm)
> + return;
> + O << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
> + // cast away const; DIetc do not take const operands for some reason
> + DIVariable V((MDNode*)(MI->getOperand(2).getMetadata()));
> + O << V.getName();
> + O << " <- ";
> + if (MI->getOperand(0).getType()==MachineOperand::MO_Register)
> + printOperand(MI, 0);
> + else {
> + assert(MI->getOperand(0).getType()==MachineOperand::MO_Immediate);
> + int64_t imm = MI->getOperand(0).getImm();
> + O << '[' << ((imm<0) ? "EBP" : "ESP+") << imm << ']';
> + }
> + O << "+";
> + printOperand(MI, 1);
> + return;
> + }
> case TargetInstrInfo::INLINEASM:
> printInlineAsm(MI);
> return;
>
> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=93499&r1=93498&r2=93499&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 14 19:54:55 2010
> @@ -591,6 +591,15 @@
> int FrameIndex = MI.getOperand(i).getIndex();
> unsigned BasePtr;
>
> + // DEBUG_VALUE has a special representation, and is only robust enough to
> + // represent SP(or BP) +- offset addressing modes. We rewrite the
> + // FrameIndex to be a constant; implicitly positive constants are relative
> + // to ESP and negative ones to EBP.
> + if (MI.getOpcode()==TargetInstrInfo::DEBUG_VALUE) {
> + MI.getOperand(i).ChangeToImmediate(getFrameIndexOffset(MF, FrameIndex));
> + return 0;
> + }
> +
> if (needsStackRealignment(MF))
> BasePtr = (FrameIndex < 0 ? FramePtr : StackPtr);
> else
>
>
> _______________________________________________
> 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