Print a load of a null pointer (in intel mode) like this:
authorChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 04:07:11 +0000 (04:07 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 04:07:11 +0000 (04:07 +0000)
        mov %AX, WORD PTR [0]

instead of like this:

        mov %AX, WORD PTR []

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19501 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp

index 7f47adfe27d006cd4408bfdbaf6e9cafa5eedd96..b0d27888fc6c38a4995b65860a4effd5d79ae50b 100644 (file)
@@ -365,7 +365,7 @@ void X86IntelAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){
     printOp(DispSpec, true);
   } else {
     int DispVal = DispSpec.getImmedValue();
-    if (DispVal) {
+    if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) {
       if (NeedPlus)
         if (DispVal > 0)
           O << " + ";