From 27c31054ec10b0314c7f3d24fe58eb99d0c88573 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 25 Mar 2008 23:29:30 +0000 Subject: [PATCH] Use ## for comment delimiter on darwin x86-32, so llvm's output .s files will go through gcc -std=c99 without triggering preprocesser errors. Approach suggested by Daveed Vandevoorde. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48808 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrFPStack.td | 20 ++++---- lib/Target/X86/X86TargetAsmInfo.cpp | 5 +- .../X86/2008-03-23-DarwinAsmComments.ll | 49 +++++++++++++++++++ 3 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll diff --git a/lib/Target/X86/X86InstrFPStack.td b/lib/Target/X86/X86InstrFPStack.td index 22ca7c681c7..b07b6efddc8 100644 --- a/lib/Target/X86/X86InstrFPStack.td +++ b/lib/Target/X86/X86InstrFPStack.td @@ -72,45 +72,45 @@ def fpimmneg1 : PatLeaf<(fpimm), [{ let usesCustomDAGSchedInserter = 1 in { // Expanded by the scheduler. def FP32_TO_INT16_IN_MEM : I<0, Pseudo, (outs), (ins i16mem:$dst, RFP32:$src), - "#FP32_TO_INT16_IN_MEM PSEUDO!", + "##FP32_TO_INT16_IN_MEM PSEUDO!", [(X86fp_to_i16mem RFP32:$src, addr:$dst)]>; def FP32_TO_INT32_IN_MEM : I<0, Pseudo, (outs), (ins i32mem:$dst, RFP32:$src), - "#FP32_TO_INT32_IN_MEM PSEUDO!", + "##FP32_TO_INT32_IN_MEM PSEUDO!", [(X86fp_to_i32mem RFP32:$src, addr:$dst)]>; def FP32_TO_INT64_IN_MEM : I<0, Pseudo, (outs), (ins i64mem:$dst, RFP32:$src), - "#FP32_TO_INT64_IN_MEM PSEUDO!", + "##FP32_TO_INT64_IN_MEM PSEUDO!", [(X86fp_to_i64mem RFP32:$src, addr:$dst)]>; def FP64_TO_INT16_IN_MEM : I<0, Pseudo, (outs), (ins i16mem:$dst, RFP64:$src), - "#FP64_TO_INT16_IN_MEM PSEUDO!", + "##FP64_TO_INT16_IN_MEM PSEUDO!", [(X86fp_to_i16mem RFP64:$src, addr:$dst)]>; def FP64_TO_INT32_IN_MEM : I<0, Pseudo, (outs), (ins i32mem:$dst, RFP64:$src), - "#FP64_TO_INT32_IN_MEM PSEUDO!", + "##FP64_TO_INT32_IN_MEM PSEUDO!", [(X86fp_to_i32mem RFP64:$src, addr:$dst)]>; def FP64_TO_INT64_IN_MEM : I<0, Pseudo, (outs), (ins i64mem:$dst, RFP64:$src), - "#FP64_TO_INT64_IN_MEM PSEUDO!", + "##FP64_TO_INT64_IN_MEM PSEUDO!", [(X86fp_to_i64mem RFP64:$src, addr:$dst)]>; def FP80_TO_INT16_IN_MEM : I<0, Pseudo, (outs), (ins i16mem:$dst, RFP80:$src), - "#FP80_TO_INT16_IN_MEM PSEUDO!", + "##FP80_TO_INT16_IN_MEM PSEUDO!", [(X86fp_to_i16mem RFP80:$src, addr:$dst)]>; def FP80_TO_INT32_IN_MEM : I<0, Pseudo, (outs), (ins i32mem:$dst, RFP80:$src), - "#FP80_TO_INT32_IN_MEM PSEUDO!", + "##FP80_TO_INT32_IN_MEM PSEUDO!", [(X86fp_to_i32mem RFP80:$src, addr:$dst)]>; def FP80_TO_INT64_IN_MEM : I<0, Pseudo, (outs), (ins i64mem:$dst, RFP80:$src), - "#FP80_TO_INT64_IN_MEM PSEUDO!", + "##FP80_TO_INT64_IN_MEM PSEUDO!", [(X86fp_to_i64mem RFP80:$src, addr:$dst)]>; } let isTerminator = 1 in let Defs = [FP0, FP1, FP2, FP3, FP4, FP5, FP6] in - def FP_REG_KILL : I<0, Pseudo, (outs), (ins), "#FP_REG_KILL", []>; + def FP_REG_KILL : I<0, Pseudo, (outs), (ins), "##FP_REG_KILL", []>; // All FP Stack operations are represented with four instructions here. The // first three instructions, generated by the instruction selector, use "RFP32" diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 390c5a6ff30..1f78cfd08a0 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -83,8 +83,9 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { PersonalitySuffix = "$non_lazy_ptr"; } NeedsIndirectEncoding = true; - InlineAsmStart = "# InlineAsm Start"; - InlineAsmEnd = "# InlineAsm End"; + InlineAsmStart = "## InlineAsm Start"; + InlineAsmEnd = "## InlineAsm End"; + CommentString = "##"; SetDirective = "\t.set"; PCSymbol = "."; UsedDirective = "\t.no_dead_strip\t"; diff --git a/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll b/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll new file mode 100644 index 00000000000..3d5a86cd243 --- /dev/null +++ b/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll @@ -0,0 +1,49 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep {#} | not grep -v {##} + + %struct.AGenericCall = type { %struct.AGenericManager*, %struct.ComponentParameters*, i32* } + %struct.AGenericManager = type <{ i8 }> + %struct.ComponentInstanceRecord = type opaque + %struct.ComponentParameters = type { [1 x i64] } + +define i32 @_ZN12AGenericCall10MapIDPtrAtEsRP23ComponentInstanceRecord(%struct.AGenericCall* %this, i16 signext %param, %struct.ComponentInstanceRecord** %instance) { +entry: + %tmp4 = icmp slt i16 %param, 0 ; [#uses=1] + br i1 %tmp4, label %cond_true, label %cond_next + +cond_true: ; preds = %entry + %tmp1415 = shl i16 %param, 3 ; [#uses=1] + %tmp17 = getelementptr %struct.AGenericCall* %this, i32 0, i32 1 ; <%struct.ComponentParameters**> [#uses=1] + %tmp18 = load %struct.ComponentParameters** %tmp17, align 8 ; <%struct.ComponentParameters*> [#uses=1] + %tmp1920 = bitcast %struct.ComponentParameters* %tmp18 to i8* ; [#uses=1] + %tmp212223 = sext i16 %tmp1415 to i64 ; [#uses=1] + %tmp24 = getelementptr i8* %tmp1920, i64 %tmp212223 ; [#uses=1] + %tmp2425 = bitcast i8* %tmp24 to i64* ; [#uses=1] + %tmp28 = load i64* %tmp2425, align 8 ; [#uses=1] + %tmp2829 = inttoptr i64 %tmp28 to i32* ; [#uses=1] + %tmp31 = getelementptr %struct.AGenericCall* %this, i32 0, i32 2 ; [#uses=1] + store i32* %tmp2829, i32** %tmp31, align 8 + br label %cond_next + +cond_next: ; preds = %cond_true, %entry + %tmp4243 = shl i16 %param, 3 ; [#uses=1] + %tmp46 = getelementptr %struct.AGenericCall* %this, i32 0, i32 1 ; <%struct.ComponentParameters**> [#uses=1] + %tmp47 = load %struct.ComponentParameters** %tmp46, align 8 ; <%struct.ComponentParameters*> [#uses=1] + %tmp4849 = bitcast %struct.ComponentParameters* %tmp47 to i8* ; [#uses=1] + %tmp505152 = sext i16 %tmp4243 to i64 ; [#uses=1] + %tmp53 = getelementptr i8* %tmp4849, i64 %tmp505152 ; [#uses=1] + %tmp5354 = bitcast i8* %tmp53 to i64* ; [#uses=1] + %tmp58 = load i64* %tmp5354, align 8 ; [#uses=1] + %tmp59 = icmp eq i64 %tmp58, 0 ; [#uses=1] + br i1 %tmp59, label %UnifiedReturnBlock, label %cond_true63 + +cond_true63: ; preds = %cond_next + %tmp65 = getelementptr %struct.AGenericCall* %this, i32 0, i32 0 ; <%struct.AGenericManager**> [#uses=1] + %tmp66 = load %struct.AGenericManager** %tmp65, align 8 ; <%struct.AGenericManager*> [#uses=1] + %tmp69 = tail call i32 @_ZN15AGenericManager24DefaultComponentInstanceERP23ComponentInstanceRecord( %struct.AGenericManager* %tmp66, %struct.ComponentInstanceRecord** %instance ) ; [#uses=1] + ret i32 %tmp69 + +UnifiedReturnBlock: ; preds = %cond_next + ret i32 undef +} + +declare i32 @_ZN15AGenericManager24DefaultComponentInstanceERP23ComponentInstanceRecord(%struct.AGenericManager*, %struct.ComponentInstanceRecord**)