llvm.org GIT mirror llvm / 3c2734c
Handle 'r' inline asm constraint git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79648 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
3 changed file(s) with 148 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
161161 llvm_unreachable("Should not custom lower this!");
162162 return SDValue();
163163 }
164 }
165
166 //===----------------------------------------------------------------------===//
167 // SystemZ Inline Assembly Support
168 //===----------------------------------------------------------------------===//
169
170 /// getConstraintType - Given a constraint letter, return the type of
171 /// constraint it is for this target.
172 TargetLowering::ConstraintType
173 SystemZTargetLowering::getConstraintType(const std::string &Constraint) const {
174 if (Constraint.size() == 1) {
175 switch (Constraint[0]) {
176 case 'r':
177 return C_RegisterClass;
178 default:
179 break;
180 }
181 }
182 return TargetLowering::getConstraintType(Constraint);
183 }
184
185 std::pair
186 SystemZTargetLowering::
187 getRegForInlineAsmConstraint(const std::string &Constraint,
188 EVT VT) const {
189 if (Constraint.size() == 1) {
190 // GCC Constraint Letters
191 switch (Constraint[0]) {
192 default: break;
193 case 'r': // GENERAL_REGS
194 if (VT == MVT::i32)
195 return std::make_pair(0U, SystemZ::GR32RegisterClass);
196 else if (VT == MVT::i128)
197 return std::make_pair(0U, SystemZ::GR128RegisterClass);
198
199 return std::make_pair(0U, SystemZ::GR64RegisterClass);
200 }
201 }
202
203 return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT);
164204 }
165205
166206 //===----------------------------------------------------------------------===//
6868 return 1;
6969 }
7070
71 std::pair
72 getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const;
73 TargetLowering::ConstraintType
74 getConstraintType(const std::string &Constraint) const;
75
7176 SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG);
7277 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG);
7378 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG);
0 ; RUN: llvm-as < %s | llc
1 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:16:16-f128:128:128"
2 target triple = "s390x-ibm-linux-gnu"
3
4 %0 = type { i64 }
5 %struct.anon = type { %struct.dwarf_fde* }
6 %struct.dwarf_fde = type <{ i32, i32, [0 x i8] }>
7 %struct.object = type { i8*, i8*, i8*, %struct.anon, %0, %struct.object* }
8
9 @__dso_handle = hidden global i8* null ; [#uses=0]
10 @__CTOR_LIST__ = internal global [1 x void ()*] [void ()* inttoptr (i64 -1 to void ()*)], section ".ctors", align 8 ; <[1 x void ()*]*> [#uses=1]
11 @__DTOR_LIST__ = internal global [1 x void ()*] [void ()* inttoptr (i64 -1 to void ()*)], section ".dtors", align 8 ; <[1 x void ()*]*> [#uses=2]
12 @__EH_FRAME_BEGIN__ = internal constant [0 x i8] zeroinitializer, section ".eh_frame", align 4 ; <[0 x i8]*> [#uses=1]
13 @__JCR_LIST__ = internal global [0 x i8*] zeroinitializer, section ".jcr", align 8 ; <[0 x i8*]*> [#uses=2]
14 @completed.1298.b = internal global i1 false ; [#uses=2]
15 @p.1296 = internal global void ()** getelementptr ([1 x void ()*]* @__DTOR_LIST__, i64 1, i64 0) ; [#uses=3]
16 @object.1314 = internal global %struct.object zeroinitializer ; <%struct.object*> [#uses=1]
17 @llvm.used = appending global [7 x i8*] [i8* bitcast ([1 x void ()*]* @__CTOR_LIST__ to i8*), i8* bitcast ([1 x void ()*]* @__DTOR_LIST__ to i8*), i8* getelementptr inbounds ([0 x i8]* @__EH_FRAME_BEGIN__, i32 0, i32 0), i8* bitcast (void ()* @__do_global_dtors_aux to i8*), i8* bitcast (void ()* @call___do_global_dtors_aux to i8*), i8* bitcast (void ()* @frame_dummy to i8*), i8* bitcast (void ()* @call_frame_dummy to i8*)], section "llvm.metadata" ; <[7 x i8*]*> [#uses=0]
18
19 define internal void @__do_global_dtors_aux() nounwind {
20 entry:
21 %.b = load i1* @completed.1298.b ; [#uses=1]
22 br i1 %.b, label %return, label %bb1.preheader
23
24 bb1.preheader: ; preds = %entry
25 %0 = load void ()*** @p.1296, align 8 ; [#uses=2]
26 %1 = load void ()** %0, align 8 ; [#uses=2]
27 %2 = icmp eq void ()* %1, null ; [#uses=1]
28 br i1 %2, label %bb2, label %bb
29
30 bb: ; preds = %bb, %bb1.preheader
31 %3 = phi void ()** [ %0, %bb1.preheader ], [ %6, %bb ] ; [#uses=1]
32 %4 = phi void ()* [ %1, %bb1.preheader ], [ %7, %bb ] ; [#uses=1]
33 %5 = getelementptr inbounds void ()** %3, i64 1 ; [#uses=1]
34 store void ()** %5, void ()*** @p.1296, align 8
35 tail call void %4() nounwind
36 %6 = load void ()*** @p.1296, align 8 ; [#uses=2]
37 %7 = load void ()** %6, align 8 ; [#uses=2]
38 %8 = icmp eq void ()* %7, null ; [#uses=1]
39 br i1 %8, label %bb2, label %bb
40
41 bb2: ; preds = %bb, %bb1.preheader
42 br i1 icmp ne (i8* (i8*)* @__deregister_frame_info, i8* (i8*)* null), label %bb3, label %bb4
43
44 bb3: ; preds = %bb2
45 %9 = tail call i8* @__deregister_frame_info(i8* getelementptr inbounds ([0 x i8]* @__EH_FRAME_BEGIN__, i32 0, i32 0)) nounwind ; [#uses=0]
46 br label %bb4
47
48 bb4: ; preds = %bb2, %bb3
49 store i1 true, i1* @completed.1298.b
50 ret void
51
52 return: ; preds = %entry
53 ret void
54 }
55
56 declare extern_weak i8* @__deregister_frame_info(i8*)
57
58 define internal void @call___do_global_dtors_aux() nounwind {
59 entry:
60 tail call void asm sideeffect "\09.section\09.fini", ""() nounwind
61 tail call void @__do_global_dtors_aux() nounwind
62 tail call void asm sideeffect ".text", ""() nounwind
63 ret void
64 }
65
66 define internal void @frame_dummy() nounwind {
67 entry:
68 br i1 icmp ne (void (i8*, %struct.object*)* @__register_frame_info, void (i8*, %struct.object*)* null), label %bb, label %bb1
69
70 bb: ; preds = %entry
71 tail call void @__register_frame_info(i8* getelementptr inbounds ([0 x i8]* @__EH_FRAME_BEGIN__, i32 0, i32 0), %struct.object* @object.1314) nounwind
72 br label %bb1
73
74 bb1: ; preds = %entry, %bb
75 %0 = load i8** getelementptr inbounds ([0 x i8*]* @__JCR_LIST__, i64 0, i64 0), align 8 ; [#uses=1]
76 %1 = icmp eq i8* %0, null ; [#uses=1]
77 br i1 %1, label %return, label %bb2
78
79 bb2: ; preds = %bb1
80 %asmtmp = tail call void (i8*)* (void (i8*)*)* asm "", "=r,0"(void (i8*)* @_Jv_RegisterClasses) nounwind ; [#uses=2]
81 %2 = icmp eq void (i8*)* %asmtmp, null ; [#uses=1]
82 br i1 %2, label %return, label %bb3
83
84 bb3: ; preds = %bb2
85 tail call void %asmtmp(i8* bitcast ([0 x i8*]* @__JCR_LIST__ to i8*)) nounwind
86 ret void
87
88 return: ; preds = %bb2, %bb1
89 ret void
90 }
91
92 declare extern_weak void @__register_frame_info(i8*, %struct.object*)
93
94 declare extern_weak void @_Jv_RegisterClasses(i8*)
95
96 define internal void @call_frame_dummy() nounwind {
97 entry:
98 tail call void asm sideeffect "\09.section\09.init", ""() nounwind
99 tail call void @frame_dummy() nounwind
100 tail call void asm sideeffect ".text", ""() nounwind
101 ret void
102 }