[llvm] r231400 - [AArch64] Teach AsmPrinter about GlobalAddress operands.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Thu Mar 5 13:59:20 PST 2015
Tim, Tom,
This is a very simple fix for an inline asm crash (PR22761).
How about putting it into 3.6.1 (and 3.5 perhaps)?
-Ahmed
On Thu, Mar 5, 2015 at 12:04 PM, Ahmed Bougacha
<ahmed.bougacha at gmail.com> wrote:
> Author: ab
> Date: Thu Mar 5 14:04:21 2015
> New Revision: 231400
>
> URL: http://llvm.org/viewvc/llvm-project?rev=231400&view=rev
> Log:
> [AArch64] Teach AsmPrinter about GlobalAddress operands.
>
> Fixes PR22761, rdar://20024866.
> Differential Revision: http://reviews.llvm.org/D8042
>
> Added:
> llvm/trunk/test/CodeGen/AArch64/inline-asm-globaladdress.ll
> Modified:
> llvm/trunk/lib/Target/AArch64/AArch64AsmPrinter.cpp
>
> Modified: llvm/trunk/lib/Target/AArch64/AArch64AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64AsmPrinter.cpp?rev=231400&r1=231399&r2=231400&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AArch64/AArch64AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/AArch64/AArch64AsmPrinter.cpp Thu Mar 5 14:04:21 2015
> @@ -36,6 +36,7 @@
> #include "llvm/MC/MCInstBuilder.h"
> #include "llvm/MC/MCLinkerOptimizationHint.h"
> #include "llvm/MC/MCStreamer.h"
> +#include "llvm/MC/MCSymbol.h"
> #include "llvm/Support/Debug.h"
> #include "llvm/Support/TargetRegistry.h"
> using namespace llvm;
> @@ -221,6 +222,17 @@ void AArch64AsmPrinter::printOperand(con
> O << '#' << Imm;
> break;
> }
> + case MachineOperand::MO_GlobalAddress: {
> + const GlobalValue *GV = MO.getGlobal();
> + MCSymbol *Sym = getSymbol(GV);
> +
> + // FIXME: Can we get anything other than a plain symbol here?
> + assert(!MO.getTargetFlags() && "Unknown operand target flag!");
> +
> + O << *Sym;
> + printOffset(MO.getOffset(), O);
> + break;
> + }
> }
> }
>
>
> Added: llvm/trunk/test/CodeGen/AArch64/inline-asm-globaladdress.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/inline-asm-globaladdress.ll?rev=231400&view=auto
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AArch64/inline-asm-globaladdress.ll (added)
> +++ llvm/trunk/test/CodeGen/AArch64/inline-asm-globaladdress.ll Thu Mar 5 14:04:21 2015
> @@ -0,0 +1,20 @@
> +; RUN: llc < %s -mtriple aarch64-gnu-linux | FileCheck %s
> +; RUN: llc < %s -mtriple arm64-apple-darwin | FileCheck %s
> +
> +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
> +
> +; CHECK-LABEL: test_inlineasm_globaladdress:
> +; CHECK: b {{_?}}test_symbol
> +define void @test_inlineasm_globaladdress() {
> + call void asm sideeffect "b $0", "i"(void ()* @test_symbol)
> + ret void
> +}
> +
> +; CHECK-LABEL: test_inlineasm_globaladdress_offset:
> +; CHECK: b {{_?}}test_symbol+4
> +define void @test_inlineasm_globaladdress_offset() {
> + call void asm sideeffect "b $0", "i"(void ()* bitcast (i8* getelementptr (i8* bitcast (void ()* @test_symbol to i8*), i64 4) to void ()*))
> + ret void
> +}
> +
> +declare void @test_symbol()
>
>
> _______________________________________________
> 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