blob: 1fe00e090f1cc80192b806ccc49e6ce8c39f75b0 [file] [log] [blame]
Michael Gottesmanb0a50ad2013-08-12 21:02:02 +00001//===-- SelectionDAGBuilder.h - Selection-DAG building --------*- C++ -*---===//
Dan Gohmanf0cbcd42008-09-03 16:12:24 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This implements routines for translating from LLVM IR into SelectionDAG IR.
11//
12//===----------------------------------------------------------------------===//
13
Dan Gohman2048b852009-11-23 18:04:58 +000014#ifndef SELECTIONDAGBUILDER_H
15#define SELECTIONDAGBUILDER_H
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000016
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000017#include "llvm/ADT/APInt.h"
18#include "llvm/ADT/DenseMap.h"
Chandler Carrutha1514e22012-12-04 07:12:27 +000019#include "llvm/CodeGen/SelectionDAG.h"
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000020#include "llvm/CodeGen/SelectionDAGNodes.h"
Bill Wendling0eb96fd2009-02-03 01:32:22 +000021#include "llvm/CodeGen/ValueTypes.h"
Chandler Carruth0b8c9a82013-01-02 11:36:10 +000022#include "llvm/IR/Constants.h"
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000023#include "llvm/Support/CallSite.h"
Torok Edwinc25e7582009-07-11 20:10:48 +000024#include "llvm/Support/ErrorHandling.h"
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000025#include <vector>
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000026
27namespace llvm {
28
29class AliasAnalysis;
30class AllocaInst;
31class BasicBlock;
32class BitCastInst;
33class BranchInst;
34class CallInst;
Devang Patel4cf81c42010-08-26 23:35:15 +000035class DbgValueInst;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000036class ExtractElementInst;
37class ExtractValueInst;
38class FCmpInst;
39class FPExtInst;
40class FPToSIInst;
41class FPToUIInst;
42class FPTruncInst;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000043class Function;
Dan Gohman6277eb22009-11-23 17:16:22 +000044class FunctionLoweringInfo;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000045class GetElementPtrInst;
46class GCFunctionInfo;
47class ICmpInst;
48class IntToPtrInst;
Chris Lattnerab21db72009-10-28 00:19:10 +000049class IndirectBrInst;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000050class InvokeInst;
51class InsertElementInst;
52class InsertValueInst;
53class Instruction;
54class LoadInst;
55class MachineBasicBlock;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000056class MachineInstr;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000057class MachineRegisterInfo;
Evan Cheng2ad0fcf2010-04-28 23:08:54 +000058class MDNode;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000059class PHINode;
60class PtrToIntInst;
61class ReturnInst;
Dale Johannesenbdc09d92010-07-16 00:02:08 +000062class SDDbgValue;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000063class SExtInst;
64class SelectInst;
65class ShuffleVectorInst;
66class SIToFPInst;
67class StoreInst;
68class SwitchInst;
Micah Villmow3574eca2012-10-08 16:38:25 +000069class DataLayout;
Owen Anderson243eb9e2011-12-08 22:15:21 +000070class TargetLibraryInfo;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000071class TargetLowering;
72class TruncInst;
73class UIToFPInst;
74class UnreachableInst;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000075class VAArgInst;
76class ZExtInst;
77
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000078//===----------------------------------------------------------------------===//
Dan Gohman2048b852009-11-23 18:04:58 +000079/// SelectionDAGBuilder - This is the common target-independent lowering
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000080/// implementation that is parameterized by a TargetLowering object.
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000081///
Dan Gohman2048b852009-11-23 18:04:58 +000082class SelectionDAGBuilder {
Andrew Trickea5db0c2013-05-25 02:20:36 +000083 /// CurInst - The current instruction being visited
84 const Instruction *CurInst;
Dale Johannesen66978ee2009-01-31 02:22:37 +000085
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000086 DenseMap<const Value*, SDValue> NodeMap;
Devang Patel9126c0d2010-06-01 19:59:01 +000087
88 /// UnusedArgNodeMap - Maps argument value for unused arguments. This is used
89 /// to preserve debug information for incoming arguments.
90 DenseMap<const Value*, SDValue> UnusedArgNodeMap;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +000091
Dale Johannesenbdc09d92010-07-16 00:02:08 +000092 /// DanglingDebugInfo - Helper type for DanglingDebugInfoMap.
93 class DanglingDebugInfo {
Devang Patel4cf81c42010-08-26 23:35:15 +000094 const DbgValueInst* DI;
Dale Johannesenbdc09d92010-07-16 00:02:08 +000095 DebugLoc dl;
96 unsigned SDNodeOrder;
97 public:
98 DanglingDebugInfo() : DI(0), dl(DebugLoc()), SDNodeOrder(0) { }
Devang Patel4cf81c42010-08-26 23:35:15 +000099 DanglingDebugInfo(const DbgValueInst *di, DebugLoc DL, unsigned SDNO) :
Dale Johannesenbdc09d92010-07-16 00:02:08 +0000100 DI(di), dl(DL), SDNodeOrder(SDNO) { }
Devang Patel4cf81c42010-08-26 23:35:15 +0000101 const DbgValueInst* getDI() { return DI; }
Dale Johannesenbdc09d92010-07-16 00:02:08 +0000102 DebugLoc getdl() { return dl; }
103 unsigned getSDNodeOrder() { return SDNodeOrder; }
104 };
105
106 /// DanglingDebugInfoMap - Keeps track of dbg_values for which we have not
107 /// yet seen the referent. We defer handling these until we do see it.
108 DenseMap<const Value*, DanglingDebugInfo> DanglingDebugInfoMap;
109
Chris Lattner8047d9a2009-12-24 00:37:38 +0000110public:
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000111 /// PendingLoads - Loads are not emitted to the program immediately. We bunch
112 /// them up and then emit token factor nodes when possible. This allows us to
113 /// get simple disambiguation between loads without worrying about alias
114 /// analysis.
115 SmallVector<SDValue, 8> PendingLoads;
Chris Lattner8047d9a2009-12-24 00:37:38 +0000116private:
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000117
118 /// PendingExports - CopyToReg nodes that copy values to virtual registers
119 /// for export to other blocks need to be emitted before any terminator
120 /// instruction, but they have no other ordering requirements. We bunch them
121 /// up and the emit a single tokenfactor for them just before terminator
122 /// instructions.
123 SmallVector<SDValue, 8> PendingExports;
124
Bill Wendlingb4e6a5d2009-12-18 23:32:53 +0000125 /// SDNodeOrder - A unique monotonically increasing number used to order the
126 /// SDNodes we create.
127 unsigned SDNodeOrder;
128
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000129 /// Case - A struct to record the Value for a switch case, and the
130 /// case's target basic block.
131 struct Case {
Stepan Dyatkovskiy24473122012-02-01 07:49:51 +0000132 const Constant *Low;
133 const Constant *High;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000134 MachineBasicBlock* BB;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000135 uint32_t ExtraWeight;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000136
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000137 Case() : Low(0), High(0), BB(0), ExtraWeight(0) { }
Stepan Dyatkovskiy24473122012-02-01 07:49:51 +0000138 Case(const Constant *low, const Constant *high, MachineBasicBlock *bb,
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000139 uint32_t extraweight) : Low(low), High(high), BB(bb),
140 ExtraWeight(extraweight) { }
141
Chris Lattnere880efe2009-11-07 07:50:34 +0000142 APInt size() const {
143 const APInt &rHigh = cast<ConstantInt>(High)->getValue();
144 const APInt &rLow = cast<ConstantInt>(Low)->getValue();
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000145 return (rHigh - rLow + 1ULL);
146 }
147 };
148
149 struct CaseBits {
150 uint64_t Mask;
151 MachineBasicBlock* BB;
152 unsigned Bits;
Manman Ren1a710fd2012-08-24 18:14:27 +0000153 uint32_t ExtraWeight;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000154
Manman Ren1a710fd2012-08-24 18:14:27 +0000155 CaseBits(uint64_t mask, MachineBasicBlock* bb, unsigned bits,
156 uint32_t Weight):
157 Mask(mask), BB(bb), Bits(bits), ExtraWeight(Weight) { }
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000158 };
159
160 typedef std::vector<Case> CaseVector;
161 typedef std::vector<CaseBits> CaseBitsVector;
162 typedef CaseVector::iterator CaseItr;
163 typedef std::pair<CaseItr, CaseItr> CaseRange;
164
165 /// CaseRec - A struct with ctor used in lowering switches to a binary tree
166 /// of conditional branches.
167 struct CaseRec {
Dan Gohman46510a72010-04-15 01:51:59 +0000168 CaseRec(MachineBasicBlock *bb, const Constant *lt, const Constant *ge,
169 CaseRange r) :
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000170 CaseBB(bb), LT(lt), GE(ge), Range(r) {}
171
172 /// CaseBB - The MBB in which to emit the compare and branch
173 MachineBasicBlock *CaseBB;
174 /// LT, GE - If nonzero, we know the current case value must be less-than or
175 /// greater-than-or-equal-to these Constants.
Dan Gohman46510a72010-04-15 01:51:59 +0000176 const Constant *LT;
177 const Constant *GE;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000178 /// Range - A pair of iterators representing the range of case values to be
179 /// processed at this point in the binary search tree.
180 CaseRange Range;
181 };
182
183 typedef std::vector<CaseRec> CaseRecVector;
184
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000185 struct CaseBitsCmp {
Chris Lattner53334ca2010-01-01 23:37:34 +0000186 bool operator()(const CaseBits &C1, const CaseBits &C2) {
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000187 return C1.Bits > C2.Bits;
188 }
189 };
190
Chris Lattner53334ca2010-01-01 23:37:34 +0000191 size_t Clusterify(CaseVector &Cases, const SwitchInst &SI);
Anton Korobeynikov23218582008-12-23 22:25:27 +0000192
Dan Gohman2048b852009-11-23 18:04:58 +0000193 /// CaseBlock - This structure is used to communicate between
194 /// SelectionDAGBuilder and SDISel for the code generation of additional basic
195 /// blocks needed by multi-case switch statements.
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000196 struct CaseBlock {
Dan Gohman46510a72010-04-15 01:51:59 +0000197 CaseBlock(ISD::CondCode cc, const Value *cmplhs, const Value *cmprhs,
198 const Value *cmpmiddle,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000199 MachineBasicBlock *truebb, MachineBasicBlock *falsebb,
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000200 MachineBasicBlock *me,
201 uint32_t trueweight = 0, uint32_t falseweight = 0)
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000202 : CC(cc), CmpLHS(cmplhs), CmpMHS(cmpmiddle), CmpRHS(cmprhs),
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000203 TrueBB(truebb), FalseBB(falsebb), ThisBB(me),
204 TrueWeight(trueweight), FalseWeight(falseweight) { }
205
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000206 // CC - the condition code to use for the case block's setcc node
207 ISD::CondCode CC;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000208
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000209 // CmpLHS/CmpRHS/CmpMHS - The LHS/MHS/RHS of the comparison to emit.
210 // Emit by default LHS op RHS. MHS is used for range comparisons:
211 // If MHS is not null: (LHS <= MHS) and (MHS <= RHS).
Dan Gohman46510a72010-04-15 01:51:59 +0000212 const Value *CmpLHS, *CmpMHS, *CmpRHS;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000213
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000214 // TrueBB/FalseBB - the block to branch to if the setcc is true/false.
215 MachineBasicBlock *TrueBB, *FalseBB;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000216
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000217 // ThisBB - the block into which to emit the code for the setcc and branches
218 MachineBasicBlock *ThisBB;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000219
220 // TrueWeight/FalseWeight - branch weights.
221 uint32_t TrueWeight, FalseWeight;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000222 };
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000223
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000224 struct JumpTable {
225 JumpTable(unsigned R, unsigned J, MachineBasicBlock *M,
226 MachineBasicBlock *D): Reg(R), JTI(J), MBB(M), Default(D) {}
227
228 /// Reg - the virtual register containing the index of the jump table entry
229 //. to jump to.
230 unsigned Reg;
231 /// JTI - the JumpTableIndex for this jump table in the function.
232 unsigned JTI;
233 /// MBB - the MBB into which to emit the code for the indirect jump.
234 MachineBasicBlock *MBB;
235 /// Default - the MBB of the default bb, which is a successor of the range
236 /// check MBB. This is when updating PHI nodes in successors.
237 MachineBasicBlock *Default;
238 };
239 struct JumpTableHeader {
Dan Gohman46510a72010-04-15 01:51:59 +0000240 JumpTableHeader(APInt F, APInt L, const Value *SV, MachineBasicBlock *H,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000241 bool E = false):
242 First(F), Last(L), SValue(SV), HeaderBB(H), Emitted(E) {}
Anton Korobeynikov23218582008-12-23 22:25:27 +0000243 APInt First;
244 APInt Last;
Dan Gohman46510a72010-04-15 01:51:59 +0000245 const Value *SValue;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000246 MachineBasicBlock *HeaderBB;
247 bool Emitted;
248 };
249 typedef std::pair<JumpTableHeader, JumpTable> JumpTableBlock;
250
251 struct BitTestCase {
Manman Ren1a710fd2012-08-24 18:14:27 +0000252 BitTestCase(uint64_t M, MachineBasicBlock* T, MachineBasicBlock* Tr,
253 uint32_t Weight):
254 Mask(M), ThisBB(T), TargetBB(Tr), ExtraWeight(Weight) { }
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000255 uint64_t Mask;
Chris Lattner53334ca2010-01-01 23:37:34 +0000256 MachineBasicBlock *ThisBB;
257 MachineBasicBlock *TargetBB;
Manman Ren1a710fd2012-08-24 18:14:27 +0000258 uint32_t ExtraWeight;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000259 };
260
261 typedef SmallVector<BitTestCase, 3> BitTestInfo;
262
263 struct BitTestBlock {
Dan Gohman46510a72010-04-15 01:51:59 +0000264 BitTestBlock(APInt F, APInt R, const Value* SV,
Patrik Hagglund8963fec2012-12-19 12:23:01 +0000265 unsigned Rg, MVT RgVT, bool E,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000266 MachineBasicBlock* P, MachineBasicBlock* D,
267 const BitTestInfo& C):
Evan Chengd08e5b42011-01-06 01:02:44 +0000268 First(F), Range(R), SValue(SV), Reg(Rg), RegVT(RgVT), Emitted(E),
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000269 Parent(P), Default(D), Cases(C) { }
Anton Korobeynikov23218582008-12-23 22:25:27 +0000270 APInt First;
271 APInt Range;
Dan Gohman46510a72010-04-15 01:51:59 +0000272 const Value *SValue;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000273 unsigned Reg;
Patrik Hagglund8963fec2012-12-19 12:23:01 +0000274 MVT RegVT;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000275 bool Emitted;
276 MachineBasicBlock *Parent;
277 MachineBasicBlock *Default;
278 BitTestInfo Cases;
279 };
280
Michael Gottesman657484f2013-08-20 07:00:16 +0000281 /// A class which encapsulates all of the information needed to generate a
282 /// stack protector check and signals to isel via its state being initialized
283 /// that a stack protector needs to be generated.
284 ///
285 /// *NOTE* The following is a high level documentation of SelectionDAG Stack
286 /// Protector Generation. The reason that it is placed here is for a lack of
287 /// other good places to stick it.
288 ///
289 /// High Level Overview of SelectionDAG Stack Protector Generation:
290 ///
291 /// Previously, generation of stack protectors was done exclusively in the
292 /// pre-SelectionDAG Codegen LLVM IR Pass "Stack Protector". This necessitated
293 /// splitting basic blocks at the IR level to create the success/failure basic
294 /// blocks in the tail of the basic block in question. As a result of this,
295 /// calls that would have qualified for the sibling call optimization were no
296 /// longer eligible for optimization since said calls were no longer right in
297 /// the "tail position" (i.e. the immediate predecessor of a ReturnInst
298 /// instruction).
299 ///
300 /// Then it was noticed that since the sibling call optimization causes the
301 /// callee to reuse the caller's stack, if we could delay the generation of
302 /// the stack protector check until later in CodeGen after the sibling call
303 /// decision was made, we get both the tail call optimization and the stack
304 /// protector check!
305 ///
306 /// A few goals in solving this problem were:
307 ///
308 /// 1. Preserve the architecture independence of stack protector generation.
309 ///
310 /// 2. Preserve the normal IR level stack protector check for platforms like
311 /// OpenBSD for which we support platform specific stack protector
312 /// generation.
313 ///
314 /// The main problem that guided the present solution is that one can not
315 /// solve this problem in an architecture independent manner at the IR level
316 /// only. This is because:
317 ///
318 /// 1. The decision on whether or not to perform a sibling call on certain
319 /// platforms (for instance i386) requires lower level information
320 /// related to available registers that can not be known at the IR level.
321 ///
322 /// 2. Even if the previous point were not true, the decision on whether to
323 /// perform a tail call is done in LowerCallTo in SelectionDAG which
324 /// occurs after the Stack Protector Pass. As a result, one would need to
325 /// put the relevant callinst into the stack protector check success
326 /// basic block (where the return inst is placed) and then move it back
327 /// later at SelectionDAG/MI time before the stack protector check if the
328 /// tail call optimization failed. The MI level option was nixed
329 /// immediately since it would require platform specific pattern
330 /// matching. The SelectionDAG level option was nixed because
331 /// SelectionDAG only processes one IR level basic block at a time
332 /// implying one could not create a DAG Combine to move the callinst.
333 ///
334 /// To get around this problem a few things were realized:
335 ///
336 /// 1. While one can not handle multiple IR level basic blocks at the
337 /// SelectionDAG Level, one can generate multiple machine basic blocks
338 /// for one IR level basic block. This is how we handle bit tests and
339 /// switches.
340 ///
341 /// 2. At the MI level, tail calls are represented via a special return
342 /// MIInst called "tcreturn". Thus if we know the basic block in which we
343 /// wish to insert the stack protector check, we get the correct behavior
344 /// by always inserting the stack protector check right before the return
345 /// statement. This is a "magical transformation" since no matter where
346 /// the stack protector check intrinsic is, we always insert the stack
347 /// protector check code at the end of the BB.
348 ///
349 /// Given the aforementioned constraints, the following solution was devised:
350 ///
351 /// 1. On platforms that do not support SelectionDAG stack protector check
352 /// generation, allow for the normal IR level stack protector check
353 /// generation to continue.
354 ///
355 /// 2. On platforms that do support SelectionDAG stack protector check
356 /// generation:
357 ///
358 /// a. Use the IR level stack protector pass to decide if a stack
359 /// protector is required/which BB we insert the stack protector check
360 /// in by reusing the logic already therein. If we wish to generate a
361 /// stack protector check in a basic block, we place a special IR
362 /// intrinsic called llvm.stackprotectorcheck right before the BB's
363 /// returninst or if there is a callinst that could potentially be
364 /// sibling call optimized, before the call inst.
365 ///
366 /// b. Then when a BB with said intrinsic is processed, we codegen the BB
367 /// normally via SelectBasicBlock. In said process, when we visit the
368 /// stack protector check, we do not actually emit anything into the
369 /// BB. Instead, we just initialize the stack protector descriptor
370 /// class (which involves stashing information/creating the success
371 /// mbbb and the failure mbb if we have not created one for this
372 /// function yet) and export the guard variable that we are going to
373 /// compare.
374 ///
375 /// c. After we finish selecting the basic block, in FinishBasicBlock if
376 /// the StackProtectorDescriptor attached to the SelectionDAGBuilder is
377 /// initialized, we first find a splice point in the parent basic block
378 /// before the terminator and then splice the terminator of said basic
379 /// block into the success basic block. Then we code-gen a new tail for
380 /// the parent basic block consisting of the two loads, the comparison,
381 /// and finally two branches to the success/failure basic blocks. We
382 /// conclude by code-gening the failure basic block if we have not
383 /// code-gened it already (all stack protector checks we generate in
384 /// the same function, use the same failure basic block).
385 class StackProtectorDescriptor {
386 public:
387 StackProtectorDescriptor() : ParentMBB(0), SuccessMBB(0), FailureMBB(0),
388 Guard(0) { }
389 ~StackProtectorDescriptor() { }
390
391 /// Returns true if all fields of the stack protector descriptor are
392 /// initialized implying that we should/are ready to emit a stack protector.
393 bool shouldEmitStackProtector() const {
394 return ParentMBB && SuccessMBB && FailureMBB && Guard;
395 }
396
397 /// Initialize the stack protector descriptor structure for a new basic
398 /// block.
399 void initialize(const BasicBlock *BB,
400 MachineBasicBlock *MBB,
401 const CallInst &StackProtCheckCall) {
402 // Make sure we are not initialized yet.
403 assert(!shouldEmitStackProtector() && "Stack Protector Descriptor is "
404 "already initialized!");
405 ParentMBB = MBB;
406 SuccessMBB = AddSuccessorMBB(BB, MBB);
407 FailureMBB = AddSuccessorMBB(BB, MBB, FailureMBB);
408 if (!Guard)
409 Guard = StackProtCheckCall.getArgOperand(0);
410 }
411
412 /// Reset state that changes when we handle different basic blocks.
413 ///
414 /// This currently includes:
415 ///
416 /// 1. The specific basic block we are generating a
417 /// stack protector for (ParentMBB).
418 ///
419 /// 2. The successor machine basic block that will contain the tail of
420 /// parent mbb after we create the stack protector check (SuccessMBB). This
421 /// BB is visited only on stack protector check success.
422 void resetPerBBState() {
423 ParentMBB = 0;
424 SuccessMBB = 0;
425 }
426
427 /// Reset state that only changes when we switch functions.
428 ///
429 /// This currently includes:
430 ///
431 /// 1. FailureMBB since we reuse the failure code path for all stack
432 /// protector checks created in an individual function.
433 ///
434 /// 2.The guard variable since the guard variable we are checking against is
435 /// always the same.
436 void resetPerFunctionState() {
437 FailureMBB = 0;
438 Guard = 0;
439 }
440
441 MachineBasicBlock *getParentMBB() { return ParentMBB; }
442 MachineBasicBlock *getSuccessMBB() { return SuccessMBB; }
443 MachineBasicBlock *getFailureMBB() { return FailureMBB; }
444 const Value *getGuard() { return Guard; }
445
446 private:
447 /// The basic block for which we are generating the stack protector.
448 ///
449 /// As a result of stack protector generation, we will splice the
450 /// terminators of this basic block into the successor mbb SuccessMBB and
451 /// replace it with a compare/branch to the successor mbbs
452 /// SuccessMBB/FailureMBB depending on whether or not the stack protector
453 /// was violated.
454 MachineBasicBlock *ParentMBB;
455
456 /// A basic block visited on stack protector check success that contains the
457 /// terminators of ParentMBB.
458 MachineBasicBlock *SuccessMBB;
459
460 /// This basic block visited on stack protector check failure that will
461 /// contain a call to __stack_chk_fail().
462 MachineBasicBlock *FailureMBB;
463
464 /// The guard variable which we will compare against the stored value in the
465 /// stack protector stack slot.
466 const Value *Guard;
467
468 /// Add a successor machine basic block to ParentMBB. If the successor mbb
469 /// has not been created yet (i.e. if SuccMBB = 0), then the machine basic
470 /// block will be created.
471 MachineBasicBlock *AddSuccessorMBB(const BasicBlock *BB,
472 MachineBasicBlock *ParentMBB,
473 MachineBasicBlock *SuccMBB = 0);
474 };
475
Bill Wendlingba54bca2013-06-19 21:36:55 +0000476private:
Dan Gohman55e59c12010-04-19 19:05:59 +0000477 const TargetMachine &TM;
Bill Wendlingba54bca2013-06-19 21:36:55 +0000478public:
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000479 SelectionDAG &DAG;
Micah Villmow3574eca2012-10-08 16:38:25 +0000480 const DataLayout *TD;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000481 AliasAnalysis *AA;
Owen Anderson243eb9e2011-12-08 22:15:21 +0000482 const TargetLibraryInfo *LibInfo;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000483
484 /// SwitchCases - Vector of CaseBlock structures used to communicate
485 /// SwitchInst code generation information.
486 std::vector<CaseBlock> SwitchCases;
487 /// JTCases - Vector of JumpTable structures used to communicate
488 /// SwitchInst code generation information.
489 std::vector<JumpTableBlock> JTCases;
490 /// BitTestCases - Vector of BitTestBlock structures used to communicate
491 /// SwitchInst code generation information.
492 std::vector<BitTestBlock> BitTestCases;
Michael Gottesman657484f2013-08-20 07:00:16 +0000493 /// A StackProtectorDescriptor structure used to communicate stack protector
494 /// information in between SelectBasicBlock and FinishBasicBlock.
495 StackProtectorDescriptor SPDescriptor;
Evan Chengfb2e7522009-09-18 21:02:19 +0000496
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000497 // Emit PHI-node-operand constants only once even if used by multiple
498 // PHI nodes.
Dan Gohman46510a72010-04-15 01:51:59 +0000499 DenseMap<const Constant *, unsigned> ConstantsOut;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000500
501 /// FuncInfo - Information about the function as a whole.
502 ///
503 FunctionLoweringInfo &FuncInfo;
Bill Wendlingdfdacee2009-02-19 21:12:54 +0000504
Bill Wendlingbe8cc2a2009-04-29 00:15:41 +0000505 /// OptLevel - What optimization level we're generating code for.
Bill Wendlingdfdacee2009-02-19 21:12:54 +0000506 ///
Bill Wendling98a366d2009-04-29 23:29:43 +0000507 CodeGenOpt::Level OptLevel;
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000508
509 /// GFI - Garbage collection metadata for the function.
510 GCFunctionInfo *GFI;
511
Bill Wendling30e67402011-10-05 22:24:35 +0000512 /// LPadToCallSiteMap - Map a landing pad to the call site indexes.
513 DenseMap<MachineBasicBlock*, SmallVector<unsigned, 4> > LPadToCallSiteMap;
Bill Wendlinga8512ed2011-10-04 22:00:35 +0000514
Dan Gohman98ca4f22009-08-05 01:29:28 +0000515 /// HasTailCall - This is set to true if a call in the current
516 /// block has been translated as a tail call. In this case,
517 /// no subsequent DAG nodes should be created.
518 ///
519 bool HasTailCall;
520
Owen Anderson0a5372e2009-07-13 04:09:18 +0000521 LLVMContext *Context;
522
Dan Gohman55e59c12010-04-19 19:05:59 +0000523 SelectionDAGBuilder(SelectionDAG &dag, FunctionLoweringInfo &funcinfo,
Dan Gohman2048b852009-11-23 18:04:58 +0000524 CodeGenOpt::Level ol)
Andrew Trickea5db0c2013-05-25 02:20:36 +0000525 : CurInst(NULL), SDNodeOrder(0), TM(dag.getTarget()),
Dan Gohman55e59c12010-04-19 19:05:59 +0000526 DAG(dag), FuncInfo(funcinfo), OptLevel(ol),
Richard Smithcb1f68d2012-08-22 00:42:39 +0000527 HasTailCall(false) {
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000528 }
529
Owen Anderson243eb9e2011-12-08 22:15:21 +0000530 void init(GCFunctionInfo *gfi, AliasAnalysis &aa,
531 const TargetLibraryInfo *li);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000532
Dan Gohmanb02b62a2010-04-14 18:24:06 +0000533 /// clear - Clear out the current SelectionDAG and the associated
Dan Gohman2048b852009-11-23 18:04:58 +0000534 /// state and prepare this SelectionDAGBuilder object to be used
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000535 /// for a new block. This doesn't clear out information about
536 /// additional blocks that are needed to complete switch lowering
537 /// or PHI node updating; that information is cleared out as it is
538 /// consumed.
539 void clear();
540
Devang Patel23385752011-05-23 17:44:13 +0000541 /// clearDanglingDebugInfo - Clear the dangling debug information
Benjamin Kramerd9b0b022012-06-02 10:20:22 +0000542 /// map. This function is separated from the clear so that debug
Devang Patel23385752011-05-23 17:44:13 +0000543 /// information that is dangling in a basic block can be properly
544 /// resolved in a different basic block. This allows the
545 /// SelectionDAG to resolve dangling debug information attached
546 /// to PHI nodes.
547 void clearDanglingDebugInfo();
548
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000549 /// getRoot - Return the current virtual root of the Selection DAG,
550 /// flushing any PendingLoad items. This must be done before emitting
551 /// a store or any other node that may need to be ordered after any
552 /// prior load instructions.
553 ///
554 SDValue getRoot();
555
556 /// getControlRoot - Similar to getRoot, but instead of flushing all the
557 /// PendingLoad items, flush all the PendingExports items. It is necessary
558 /// to do this before emitting a terminator instruction.
559 ///
560 SDValue getControlRoot();
561
Andrew Trickea5db0c2013-05-25 02:20:36 +0000562 SDLoc getCurSDLoc() const {
Andrew Trickea5db0c2013-05-25 02:20:36 +0000563 return SDLoc(CurInst, SDNodeOrder);
564 }
565
566 DebugLoc getCurDebugLoc() const {
567 return CurInst ? CurInst->getDebugLoc() : DebugLoc();
568 }
Devang Patel68e6bee2011-02-21 23:21:26 +0000569
Bill Wendling3ea3c242009-12-22 02:10:19 +0000570 unsigned getSDNodeOrder() const { return SDNodeOrder; }
571
Dan Gohman46510a72010-04-15 01:51:59 +0000572 void CopyValueToVirtualRegister(const Value *V, unsigned Reg);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000573
Dan Gohman46510a72010-04-15 01:51:59 +0000574 void visit(const Instruction &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000575
Dan Gohman46510a72010-04-15 01:51:59 +0000576 void visit(unsigned Opcode, const User &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000577
Dale Johannesenbdc09d92010-07-16 00:02:08 +0000578 // resolveDanglingDebugInfo - if we saw an earlier dbg_value referring to V,
579 // generate the debug data structures now that we've seen its definition.
580 void resolveDanglingDebugInfo(const Value *V, SDValue Val);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000581 SDValue getValue(const Value *V);
Dan Gohman28a17352010-07-01 01:59:43 +0000582 SDValue getNonRegisterValue(const Value *V);
583 SDValue getValueImpl(const Value *V);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000584
585 void setValue(const Value *V, SDValue NewN) {
586 SDValue &N = NodeMap[V];
587 assert(N.getNode() == 0 && "Already set a value for this node!");
588 N = NewN;
589 }
590
Devang Patel9126c0d2010-06-01 19:59:01 +0000591 void setUnusedArgValue(const Value *V, SDValue NewN) {
592 SDValue &N = UnusedArgNodeMap[V];
593 assert(N.getNode() == 0 && "Already set a value for this node!");
594 N = NewN;
595 }
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000596
Dan Gohman46510a72010-04-15 01:51:59 +0000597 void FindMergedConditions(const Value *Cond, MachineBasicBlock *TBB,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000598 MachineBasicBlock *FBB, MachineBasicBlock *CurBB,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000599 MachineBasicBlock *SwitchBB, unsigned Opc);
Dan Gohman46510a72010-04-15 01:51:59 +0000600 void EmitBranchForMergedCondition(const Value *Cond, MachineBasicBlock *TBB,
Dan Gohmanc2277342008-10-17 21:16:08 +0000601 MachineBasicBlock *FBB,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000602 MachineBasicBlock *CurBB,
603 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000604 bool ShouldEmitAsBranches(const std::vector<CaseBlock> &Cases);
Dan Gohman46510a72010-04-15 01:51:59 +0000605 bool isExportableFromCurrentBlock(const Value *V, const BasicBlock *FromBB);
606 void CopyToExportRegsIfNeeded(const Value *V);
607 void ExportFromCurrentBlock(const Value *V);
608 void LowerCallTo(ImmutableCallSite CS, SDValue Callee, bool IsTailCall,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000609 MachineBasicBlock *LandingPad = NULL);
610
Jakob Stoklund Olesen2622f462010-09-30 19:44:31 +0000611 /// UpdateSplitBlock - When an MBB was split during scheduling, update the
612 /// references that ned to refer to the last resulting block.
613 void UpdateSplitBlock(MachineBasicBlock *First, MachineBasicBlock *Last);
614
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000615private:
616 // Terminator instructions.
Dan Gohman46510a72010-04-15 01:51:59 +0000617 void visitRet(const ReturnInst &I);
618 void visitBr(const BranchInst &I);
619 void visitSwitch(const SwitchInst &I);
620 void visitIndirectBr(const IndirectBrInst &I);
Bill Wendlinga60f0e72010-07-15 23:42:21 +0000621 void visitUnreachable(const UnreachableInst &I) { /* noop */ }
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000622
623 // Helpers for visitSwitch
624 bool handleSmallSwitchRange(CaseRec& CR,
625 CaseRecVector& WorkList,
Dan Gohman46510a72010-04-15 01:51:59 +0000626 const Value* SV,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000627 MachineBasicBlock* Default,
628 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000629 bool handleJTSwitchCase(CaseRec& CR,
630 CaseRecVector& WorkList,
Dan Gohman46510a72010-04-15 01:51:59 +0000631 const Value* SV,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000632 MachineBasicBlock* Default,
633 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000634 bool handleBTSplitSwitchCase(CaseRec& CR,
635 CaseRecVector& WorkList,
Dan Gohman46510a72010-04-15 01:51:59 +0000636 const Value* SV,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000637 MachineBasicBlock* Default,
638 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000639 bool handleBitTestsSwitchCase(CaseRec& CR,
640 CaseRecVector& WorkList,
Dan Gohman46510a72010-04-15 01:51:59 +0000641 const Value* SV,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000642 MachineBasicBlock* Default,
643 MachineBasicBlock *SwitchBB);
Jakub Staszak7cc2b072011-06-16 20:22:37 +0000644
Jakub Staszak25101bb2011-12-20 20:03:10 +0000645 uint32_t getEdgeWeight(const MachineBasicBlock *Src,
646 const MachineBasicBlock *Dst) const;
Jakub Staszakc8f34de2011-07-29 22:25:21 +0000647 void addSuccessorWithWeight(MachineBasicBlock *Src, MachineBasicBlock *Dst,
648 uint32_t Weight = 0);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000649public:
Dan Gohman99be8ae2010-04-19 22:41:47 +0000650 void visitSwitchCase(CaseBlock &CB,
651 MachineBasicBlock *SwitchBB);
Michael Gottesman657484f2013-08-20 07:00:16 +0000652 void visitSPDescriptorParent(StackProtectorDescriptor &SPD,
653 MachineBasicBlock *ParentBB);
654 void visitSPDescriptorFailure(StackProtectorDescriptor &SPD);
Dan Gohman99be8ae2010-04-19 22:41:47 +0000655 void visitBitTestHeader(BitTestBlock &B, MachineBasicBlock *SwitchBB);
Evan Chengd08e5b42011-01-06 01:02:44 +0000656 void visitBitTestCase(BitTestBlock &BB,
657 MachineBasicBlock* NextMBB,
Manman Ren1a710fd2012-08-24 18:14:27 +0000658 uint32_t BranchWeightToNext,
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000659 unsigned Reg,
Dan Gohman99be8ae2010-04-19 22:41:47 +0000660 BitTestCase &B,
661 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000662 void visitJumpTable(JumpTable &JT);
Dan Gohman99be8ae2010-04-19 22:41:47 +0000663 void visitJumpTableHeader(JumpTable &JT, JumpTableHeader &JTH,
664 MachineBasicBlock *SwitchBB);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000665
666private:
667 // These all get lowered before this pass.
Dan Gohman46510a72010-04-15 01:51:59 +0000668 void visitInvoke(const InvokeInst &I);
Bill Wendlingdccc03b2011-07-31 06:30:59 +0000669 void visitResume(const ResumeInst &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000670
Dan Gohman46510a72010-04-15 01:51:59 +0000671 void visitBinary(const User &I, unsigned OpCode);
672 void visitShift(const User &I, unsigned Opcode);
673 void visitAdd(const User &I) { visitBinary(I, ISD::ADD); }
674 void visitFAdd(const User &I) { visitBinary(I, ISD::FADD); }
675 void visitSub(const User &I) { visitBinary(I, ISD::SUB); }
676 void visitFSub(const User &I);
677 void visitMul(const User &I) { visitBinary(I, ISD::MUL); }
678 void visitFMul(const User &I) { visitBinary(I, ISD::FMUL); }
679 void visitURem(const User &I) { visitBinary(I, ISD::UREM); }
680 void visitSRem(const User &I) { visitBinary(I, ISD::SREM); }
681 void visitFRem(const User &I) { visitBinary(I, ISD::FREM); }
682 void visitUDiv(const User &I) { visitBinary(I, ISD::UDIV); }
Benjamin Kramer9c640302011-07-08 10:31:30 +0000683 void visitSDiv(const User &I);
Dan Gohman46510a72010-04-15 01:51:59 +0000684 void visitFDiv(const User &I) { visitBinary(I, ISD::FDIV); }
685 void visitAnd (const User &I) { visitBinary(I, ISD::AND); }
686 void visitOr (const User &I) { visitBinary(I, ISD::OR); }
687 void visitXor (const User &I) { visitBinary(I, ISD::XOR); }
688 void visitShl (const User &I) { visitShift(I, ISD::SHL); }
689 void visitLShr(const User &I) { visitShift(I, ISD::SRL); }
690 void visitAShr(const User &I) { visitShift(I, ISD::SRA); }
691 void visitICmp(const User &I);
692 void visitFCmp(const User &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000693 // Visit the conversion instructions
Dan Gohman46510a72010-04-15 01:51:59 +0000694 void visitTrunc(const User &I);
695 void visitZExt(const User &I);
696 void visitSExt(const User &I);
697 void visitFPTrunc(const User &I);
698 void visitFPExt(const User &I);
699 void visitFPToUI(const User &I);
700 void visitFPToSI(const User &I);
701 void visitUIToFP(const User &I);
702 void visitSIToFP(const User &I);
703 void visitPtrToInt(const User &I);
704 void visitIntToPtr(const User &I);
705 void visitBitCast(const User &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000706
Dan Gohman46510a72010-04-15 01:51:59 +0000707 void visitExtractElement(const User &I);
708 void visitInsertElement(const User &I);
709 void visitShuffleVector(const User &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000710
Dan Gohman46510a72010-04-15 01:51:59 +0000711 void visitExtractValue(const ExtractValueInst &I);
712 void visitInsertValue(const InsertValueInst &I);
Bill Wendlinge6e88262011-08-12 20:24:12 +0000713 void visitLandingPad(const LandingPadInst &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000714
Dan Gohman46510a72010-04-15 01:51:59 +0000715 void visitGetElementPtr(const User &I);
716 void visitSelect(const User &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000717
Dan Gohman46510a72010-04-15 01:51:59 +0000718 void visitAlloca(const AllocaInst &I);
719 void visitLoad(const LoadInst &I);
720 void visitStore(const StoreInst &I);
Eli Friedmanff030482011-07-28 21:48:00 +0000721 void visitAtomicCmpXchg(const AtomicCmpXchgInst &I);
722 void visitAtomicRMW(const AtomicRMWInst &I);
Eli Friedman47f35132011-07-25 23:16:38 +0000723 void visitFence(const FenceInst &I);
Dan Gohmanba5be5c2010-04-20 15:00:41 +0000724 void visitPHI(const PHINode &I);
Dan Gohman46510a72010-04-15 01:51:59 +0000725 void visitCall(const CallInst &I);
726 bool visitMemCmpCall(const CallInst &I);
Richard Sandiford4fc73552013-08-16 11:29:37 +0000727 bool visitStrCpyCall(const CallInst &I, bool isStpcpy);
Richard Sandiforde1b2af72013-08-16 11:21:54 +0000728 bool visitStrCmpCall(const CallInst &I);
Richard Sandiford19262ee2013-08-16 11:41:43 +0000729 bool visitStrLenCall(const CallInst &I);
730 bool visitStrNLenCall(const CallInst &I);
Bob Wilson53624a22012-08-03 23:29:17 +0000731 bool visitUnaryFloatCall(const CallInst &I, unsigned Opcode);
Eli Friedman327236c2011-08-24 20:50:09 +0000732 void visitAtomicLoad(const LoadInst &I);
733 void visitAtomicStore(const StoreInst &I);
734
Dan Gohman46510a72010-04-15 01:51:59 +0000735 void visitInlineAsm(ImmutableCallSite CS);
736 const char *visitIntrinsicCall(const CallInst &I, unsigned Intrinsic);
737 void visitTargetIntrinsic(const CallInst &I, unsigned Intrinsic);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000738
Dan Gohman46510a72010-04-15 01:51:59 +0000739 void visitVAStart(const CallInst &I);
740 void visitVAArg(const VAArgInst &I);
741 void visitVAEnd(const CallInst &I);
742 void visitVACopy(const CallInst &I);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000743
Dan Gohman46510a72010-04-15 01:51:59 +0000744 void visitUserOp1(const Instruction &I) {
Torok Edwinc23197a2009-07-14 16:55:14 +0000745 llvm_unreachable("UserOp1 should not exist at instruction selection time!");
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000746 }
Dan Gohman46510a72010-04-15 01:51:59 +0000747 void visitUserOp2(const Instruction &I) {
Torok Edwinc23197a2009-07-14 16:55:14 +0000748 llvm_unreachable("UserOp2 should not exist at instruction selection time!");
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000749 }
Dan Gohmanc105a2b2010-04-22 20:55:53 +0000750
Richard Sandiford6a079fe2013-08-16 10:55:47 +0000751 void processIntegerCallValue(const Instruction &I,
752 SDValue Value, bool IsSigned);
753
Dan Gohmanc105a2b2010-04-22 20:55:53 +0000754 void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
Evan Cheng2ad0fcf2010-04-28 23:08:54 +0000755
Devang Patelab43add2010-08-25 20:41:24 +0000756 /// EmitFuncArgumentDbgValue - If V is an function argument then create
757 /// corresponding DBG_VALUE machine instruction for it now. At the end of
758 /// instruction selection, they will be inserted to the entry BB.
Devang Patel78a06e52010-08-25 20:39:26 +0000759 bool EmitFuncArgumentDbgValue(const Value *V, MDNode *Variable,
Devang Patel34ca5ed2010-08-31 06:12:08 +0000760 int64_t Offset, const SDValue &N);
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000761};
762
Dan Gohmanf0cbcd42008-09-03 16:12:24 +0000763} // end namespace llvm
764
765#endif