blob: 67cefc2714b9308cfb825a2bb3a44d2dac989c61 [file] [log] [blame]
Chris Lattnerbed31442007-05-28 01:07:47 +00001//===--- CodeGenFunction.h - Per-Function state for LLVM CodeGen ----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This is the internal per-function state used for llvm translation.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CODEGEN_CODEGENFUNCTION_H
15#define CODEGEN_CODEGENFUNCTION_H
16
Chris Lattnerac248202007-05-30 00:13:02 +000017#include "llvm/ADT/DenseMap.h"
Chris Lattnere73e4322007-07-16 21:28:45 +000018#include "llvm/ADT/SmallVector.h"
Chris Lattner308f4312007-05-29 23:50:05 +000019#include "llvm/Support/LLVMBuilder.h"
Chris Lattner2ccb73b2007-06-16 00:16:26 +000020#include <vector>
Chris Lattner308f4312007-05-29 23:50:05 +000021
Chris Lattnerbed31442007-05-28 01:07:47 +000022namespace llvm {
23 class Module;
Chris Lattner23b7eb62007-06-15 23:05:46 +000024}
25
Chris Lattnerbed31442007-05-28 01:07:47 +000026namespace clang {
27 class ASTContext;
Chris Lattner84915fa2007-06-02 04:16:21 +000028 class Decl;
Chris Lattnerbed31442007-05-28 01:07:47 +000029 class FunctionDecl;
Chris Lattner2ccb73b2007-06-16 00:16:26 +000030 class TargetInfo;
Chris Lattner2ccb73b2007-06-16 00:16:26 +000031 class QualType;
32 class FunctionTypeProto;
Chris Lattner84915fa2007-06-02 04:16:21 +000033
Chris Lattner308f4312007-05-29 23:50:05 +000034 class Stmt;
35 class CompoundStmt;
Chris Lattnerac248202007-05-30 00:13:02 +000036 class LabelStmt;
37 class GotoStmt;
Chris Lattner5269c032007-05-30 21:03:58 +000038 class IfStmt;
Chris Lattner946aa312007-06-05 03:59:43 +000039 class WhileStmt;
Chris Lattner8394d792007-06-05 20:53:16 +000040 class DoStmt;
41 class ForStmt;
Chris Lattner3f3dbee2007-06-02 03:19:07 +000042 class ReturnStmt;
Chris Lattner84915fa2007-06-02 04:16:21 +000043 class DeclStmt;
Chris Lattnerbed31442007-05-28 01:07:47 +000044
Chris Lattner208ae962007-05-30 17:57:17 +000045 class Expr;
Chris Lattnerd7f58862007-06-02 05:24:33 +000046 class DeclRefExpr;
Chris Lattner4347e3692007-06-06 04:54:52 +000047 class StringLiteral;
Chris Lattner208ae962007-05-30 17:57:17 +000048 class IntegerLiteral;
Chris Lattner2ada32e2007-07-09 23:03:16 +000049 class FloatingLiteral;
Chris Lattner6e9d9b32007-07-13 05:18:11 +000050 class CharacterLiteral;
Chris Lattner8394d792007-06-05 20:53:16 +000051 class CastExpr;
Chris Lattner2b228c92007-06-15 21:34:29 +000052 class CallExpr;
Chris Lattnerf0106d22007-06-02 19:33:17 +000053 class UnaryOperator;
Chris Lattnerdb91b162007-06-02 00:16:28 +000054 class BinaryOperator;
Chris Lattner9369a562007-06-29 16:31:29 +000055 class CompoundAssignOperator;
Chris Lattnerd9d2fb12007-06-08 23:31:14 +000056 class ArraySubscriptExpr;
Chris Lattner6e9d9b32007-07-13 05:18:11 +000057 class ConditionalOperator;
Chris Lattner208ae962007-05-30 17:57:17 +000058
Chris Lattner84915fa2007-06-02 04:16:21 +000059 class BlockVarDecl;
60 class EnumConstantDecl;
Chris Lattner53621a52007-06-13 20:44:40 +000061 class ParmVarDecl;
Chris Lattnerbed31442007-05-28 01:07:47 +000062namespace CodeGen {
63 class CodeGenModule;
64
Chris Lattnerd7f58862007-06-02 05:24:33 +000065
Chris Lattner8394d792007-06-05 20:53:16 +000066/// RValue - This trivial value class is used to represent the result of an
Chris Lattnerd7f58862007-06-02 05:24:33 +000067/// expression that is evaluated. It can be one of two things: either a simple
68/// LLVM SSA value, or the address of an aggregate value in memory. These two
69/// possibilities are discriminated by isAggregate/isScalar.
Chris Lattner8394d792007-06-05 20:53:16 +000070class RValue {
Chris Lattner23b7eb62007-06-15 23:05:46 +000071 llvm::Value *V;
Chris Lattnerdb91b162007-06-02 00:16:28 +000072 // TODO: Encode this into the low bit of pointer for more efficient
73 // return-by-value.
Chris Lattner5269c032007-05-30 21:03:58 +000074 bool IsAggregate;
Chris Lattner09153c02007-06-22 18:48:09 +000075
76 // FIXME: Aggregate rvalues need to retain information about whether they are
77 // volatile or not.
Chris Lattner5269c032007-05-30 21:03:58 +000078public:
79
80 bool isAggregate() const { return IsAggregate; }
81 bool isScalar() const { return !IsAggregate; }
82
83 /// getVal() - Return the Value* of this scalar value.
Chris Lattner23b7eb62007-06-15 23:05:46 +000084 llvm::Value *getVal() const {
Chris Lattner5269c032007-05-30 21:03:58 +000085 assert(!isAggregate() && "Not a scalar!");
86 return V;
87 }
88
Chris Lattner09153c02007-06-22 18:48:09 +000089 /// getAggregateAddr() - Return the Value* of the address of the aggregate.
90 llvm::Value *getAggregateAddr() const {
Chris Lattner5269c032007-05-30 21:03:58 +000091 assert(isAggregate() && "Not an aggregate!");
92 return V;
93 }
Chris Lattner208ae962007-05-30 17:57:17 +000094
Chris Lattner23b7eb62007-06-15 23:05:46 +000095 static RValue get(llvm::Value *V) {
Chris Lattner8394d792007-06-05 20:53:16 +000096 RValue ER;
Chris Lattner208ae962007-05-30 17:57:17 +000097 ER.V = V;
Chris Lattner5269c032007-05-30 21:03:58 +000098 ER.IsAggregate = false;
Chris Lattner208ae962007-05-30 17:57:17 +000099 return ER;
100 }
Chris Lattner23b7eb62007-06-15 23:05:46 +0000101 static RValue getAggregate(llvm::Value *V) {
Chris Lattner8394d792007-06-05 20:53:16 +0000102 RValue ER;
Chris Lattner208ae962007-05-30 17:57:17 +0000103 ER.V = V;
Chris Lattner5269c032007-05-30 21:03:58 +0000104 ER.IsAggregate = true;
Chris Lattner208ae962007-05-30 17:57:17 +0000105 return ER;
106 }
107};
Chris Lattnerd7f58862007-06-02 05:24:33 +0000108
109
110/// LValue - This represents an lvalue references. Because C/C++ allow
111/// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a
112/// bitrange.
113class LValue {
114 // FIXME: Volatility. Restrict?
Chris Lattner8394d792007-06-05 20:53:16 +0000115 // alignment?
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000116
117 enum {
118 Simple, // This is a normal l-value, use getAddress().
119 VectorElt, // This is a vector element l-value (V[i]), use getVector*
120 BitField // This is a bitfield l-value, use getBitfield*.
121 } LVType;
122
Chris Lattnerd7f58862007-06-02 05:24:33 +0000123 llvm::Value *V;
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000124
125 union {
126 llvm::Value *VectorIdx;
127 };
Chris Lattnerd7f58862007-06-02 05:24:33 +0000128public:
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000129 bool isSimple() const { return LVType == Simple; }
130 bool isVectorElt() const { return LVType == VectorElt; }
131 bool isBitfield() const { return LVType == BitField; }
Chris Lattner208ae962007-05-30 17:57:17 +0000132
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000133 // simple lvalue
134 llvm::Value *getAddress() const { assert(isSimple()); return V; }
135 // vector elt lvalue
136 llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; }
137 llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; }
Chris Lattnerd7f58862007-06-02 05:24:33 +0000138
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000139 static LValue MakeAddr(llvm::Value *V) {
Chris Lattnerd7f58862007-06-02 05:24:33 +0000140 LValue R;
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000141 R.LVType = Simple;
Chris Lattnerd7f58862007-06-02 05:24:33 +0000142 R.V = V;
143 return R;
144 }
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000145
146 static LValue MakeVectorElt(llvm::Value *Vec, llvm::Value *Idx) {
147 LValue R;
148 R.LVType = VectorElt;
149 R.V = Vec;
150 R.VectorIdx = Idx;
151 return R;
152 }
153
Chris Lattnerd7f58862007-06-02 05:24:33 +0000154};
155
Chris Lattnerbed31442007-05-28 01:07:47 +0000156/// CodeGenFunction - This class organizes the per-function state that is used
157/// while generating LLVM code.
158class CodeGenFunction {
159 CodeGenModule &CGM; // Per-module state.
Chris Lattnerd1af2d22007-05-29 23:17:50 +0000160 TargetInfo &Target;
Chris Lattner23b7eb62007-06-15 23:05:46 +0000161 llvm::LLVMBuilder Builder;
Chris Lattner3f3dbee2007-06-02 03:19:07 +0000162
163 const FunctionDecl *CurFuncDecl;
Chris Lattnerac248202007-05-30 00:13:02 +0000164 llvm::Function *CurFn;
165
Chris Lattner03df1222007-06-02 04:53:11 +0000166 /// AllocaInsertPoint - This is an instruction in the entry block before which
167 /// we prefer to insert allocas.
168 llvm::Instruction *AllocaInsertPt;
169
Chris Lattner6db1fb82007-06-02 22:49:07 +0000170 const llvm::Type *LLVMIntTy;
Chris Lattnerd9d2fb12007-06-08 23:31:14 +0000171 unsigned LLVMPointerWidth;
Chris Lattner6db1fb82007-06-02 22:49:07 +0000172
Chris Lattner84915fa2007-06-02 04:16:21 +0000173 /// LocalDeclMap - This keeps track of the LLVM allocas or globals for local C
174 /// decls.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000175 llvm::DenseMap<const Decl*, llvm::Value*> LocalDeclMap;
Chris Lattner84915fa2007-06-02 04:16:21 +0000176
Chris Lattnerac248202007-05-30 00:13:02 +0000177 /// LabelMap - This keeps track of the LLVM basic block for each C label.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000178 llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
Chris Lattnere73e4322007-07-16 21:28:45 +0000179
180 // BreakContinueStack - This keeps track of where break and continue
181 // statements should jump to.
182 struct BreakContinue {
183 BreakContinue(llvm::BasicBlock *bb, llvm::BasicBlock *cb)
184 : BreakBlock(bb), ContinueBlock(cb) {}
185
186 llvm::BasicBlock *BreakBlock;
187 llvm::BasicBlock *ContinueBlock;
188 };
189 llvm::SmallVector<BreakContinue, 8> BreakContinueStack;
190
Chris Lattnerbed31442007-05-28 01:07:47 +0000191public:
Chris Lattnerd1af2d22007-05-29 23:17:50 +0000192 CodeGenFunction(CodeGenModule &cgm);
Chris Lattnerbed31442007-05-28 01:07:47 +0000193
Chris Lattner6db1fb82007-06-02 22:49:07 +0000194 ASTContext &getContext() const;
195
Chris Lattner308f4312007-05-29 23:50:05 +0000196 void GenerateCode(const FunctionDecl *FD);
197
Chris Lattnerf033c142007-06-22 19:05:19 +0000198 const llvm::Type *ConvertType(QualType T);
Chris Lattnerac248202007-05-30 00:13:02 +0000199
Chris Lattner54fb19e2007-06-22 22:02:34 +0000200 /// hasAggregateLLVMType - Return true if the specified AST type will map into
201 /// an aggregate LLVM type or is void.
202 static bool hasAggregateLLVMType(QualType T);
203
Chris Lattnerac248202007-05-30 00:13:02 +0000204 /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
205 /// label maps to.
206 llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
207
208
Chris Lattner23b7eb62007-06-15 23:05:46 +0000209 void EmitBlock(llvm::BasicBlock *BB);
Chris Lattner84915fa2007-06-02 04:16:21 +0000210
Chris Lattnere9a64532007-06-22 21:44:33 +0000211 //===--------------------------------------------------------------------===//
212 // Helpers
213 //===--------------------------------------------------------------------===//
214
215 /// CreateTempAlloca - This creates a alloca and inserts it into the entry
216 /// block.
217 llvm::AllocaInst *CreateTempAlloca(const llvm::Type *Ty,
218 const char *Name = "tmp");
219
Chris Lattner8394d792007-06-05 20:53:16 +0000220 /// EvaluateExprAsBool - Perform the usual unary conversions on the specified
221 /// expression and compare the result against zero, returning an Int1Ty value.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000222 llvm::Value *EvaluateExprAsBool(const Expr *E);
Chris Lattnere9a64532007-06-22 21:44:33 +0000223
Chris Lattnerac248202007-05-30 00:13:02 +0000224
Chris Lattnere9a64532007-06-22 21:44:33 +0000225 /// EmitLoadOfComplex - Given an RValue reference for a complex, emit code to
226 /// load the real and imaginary pieces, returning them as Real/Imag.
227 void EmitLoadOfComplex(RValue V, llvm::Value *&Real, llvm::Value *&Imag);
228
229 /// EmitStoreOfComplex - Store the specified real/imag parts into the
230 /// specified value pointer.
231 void EmitStoreOfComplex(llvm::Value *Real, llvm::Value *Imag,
232 llvm::Value *ResPtr);
233
Chris Lattner8394d792007-06-05 20:53:16 +0000234 //===--------------------------------------------------------------------===//
235 // Conversions
236 //===--------------------------------------------------------------------===//
237
238 /// EmitConversion - Convert the value specied by Val, whose type is ValTy, to
239 /// the type specified by DstTy, following the rules of C99 6.3.
Chris Lattnerf033c142007-06-22 19:05:19 +0000240 RValue EmitConversion(RValue Val, QualType ValTy, QualType DstTy);
Chris Lattner8394d792007-06-05 20:53:16 +0000241
242 /// ConvertScalarValueToBool - Convert the specified expression value to a
Chris Lattnerf0106d22007-06-02 19:33:17 +0000243 /// boolean (i1) truth value. This is equivalent to "Val == 0".
Chris Lattner23b7eb62007-06-15 23:05:46 +0000244 llvm::Value *ConvertScalarValueToBool(RValue Val, QualType Ty);
Chris Lattnerf0106d22007-06-02 19:33:17 +0000245
Chris Lattner308f4312007-05-29 23:50:05 +0000246 //===--------------------------------------------------------------------===//
Chris Lattner53621a52007-06-13 20:44:40 +0000247 // Declaration Emission
Chris Lattner84915fa2007-06-02 04:16:21 +0000248 //===--------------------------------------------------------------------===//
249
Chris Lattner1ad38f82007-06-09 01:20:56 +0000250 void EmitDecl(const Decl &D);
Chris Lattner84915fa2007-06-02 04:16:21 +0000251 void EmitEnumConstantDecl(const EnumConstantDecl &D);
Chris Lattner03df1222007-06-02 04:53:11 +0000252 void EmitBlockVarDecl(const BlockVarDecl &D);
253 void EmitLocalBlockVarDecl(const BlockVarDecl &D);
Chris Lattner53621a52007-06-13 20:44:40 +0000254 void EmitParmDecl(const ParmVarDecl &D, llvm::Value *Arg);
Chris Lattner03df1222007-06-02 04:53:11 +0000255
Chris Lattner84915fa2007-06-02 04:16:21 +0000256 //===--------------------------------------------------------------------===//
Chris Lattner308f4312007-05-29 23:50:05 +0000257 // Statement Emission
258 //===--------------------------------------------------------------------===//
259
260 void EmitStmt(const Stmt *S);
261 void EmitCompoundStmt(const CompoundStmt &S);
Chris Lattnerac248202007-05-30 00:13:02 +0000262 void EmitLabelStmt(const LabelStmt &S);
263 void EmitGotoStmt(const GotoStmt &S);
Chris Lattner5269c032007-05-30 21:03:58 +0000264 void EmitIfStmt(const IfStmt &S);
Chris Lattner946aa312007-06-05 03:59:43 +0000265 void EmitWhileStmt(const WhileStmt &S);
Chris Lattner8394d792007-06-05 20:53:16 +0000266 void EmitDoStmt(const DoStmt &S);
267 void EmitForStmt(const ForStmt &S);
Chris Lattner3f3dbee2007-06-02 03:19:07 +0000268 void EmitReturnStmt(const ReturnStmt &S);
Chris Lattner1ad38f82007-06-09 01:20:56 +0000269 void EmitDeclStmt(const DeclStmt &S);
Chris Lattnere73e4322007-07-16 21:28:45 +0000270 void EmitBreakStmt();
271 void EmitContinueStmt();
272
Chris Lattner208ae962007-05-30 17:57:17 +0000273 //===--------------------------------------------------------------------===//
Chris Lattnerd7f58862007-06-02 05:24:33 +0000274 // LValue Expression Emission
275 //===--------------------------------------------------------------------===//
Chris Lattner8394d792007-06-05 20:53:16 +0000276
277 /// EmitLValue - Emit code to compute a designator that specifies the location
278 /// of the expression.
279 ///
280 /// This can return one of two things: a simple address or a bitfield
281 /// reference. In either case, the LLVM Value* in the LValue structure is
282 /// guaranteed to be an LLVM pointer type.
283 ///
284 /// If this returns a bitfield reference, nothing about the pointee type of
285 /// the LLVM value is known: For example, it may not be a pointer to an
286 /// integer.
287 ///
288 /// If this returns a normal address, and if the lvalue's C type is fixed
289 /// size, this method guarantees that the returned pointer type will point to
290 /// an LLVM type of the same size of the lvalue's type. If the lvalue has a
291 /// variable length type, this is not possible.
292 ///
Chris Lattnerd7f58862007-06-02 05:24:33 +0000293 LValue EmitLValue(const Expr *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000294
295 /// EmitLoadOfLValue - Given an expression that represents a value lvalue,
296 /// this method emits the address of the lvalue, then loads the result as an
297 /// rvalue, returning the rvalue.
298 RValue EmitLoadOfLValue(const Expr *E);
Chris Lattner9369a562007-06-29 16:31:29 +0000299 RValue EmitLoadOfLValue(LValue V, QualType LVType);
300
Chris Lattner8394d792007-06-05 20:53:16 +0000301 /// EmitStoreThroughLValue - Store the specified rvalue into the specified
302 /// lvalue, where both are guaranteed to the have the same type, and that type
303 /// is 'Ty'.
304 void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
305
Chris Lattnerd7f58862007-06-02 05:24:33 +0000306 LValue EmitDeclRefLValue(const DeclRefExpr *E);
Chris Lattner4347e3692007-06-06 04:54:52 +0000307 LValue EmitStringLiteralLValue(const StringLiteral *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000308 LValue EmitUnaryOpLValue(const UnaryOperator *E);
Chris Lattnerd9d2fb12007-06-08 23:31:14 +0000309 LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
Chris Lattnerd7f58862007-06-02 05:24:33 +0000310
311 //===--------------------------------------------------------------------===//
Chris Lattner208ae962007-05-30 17:57:17 +0000312 // Expression Emission
313 //===--------------------------------------------------------------------===//
314
Chris Lattner8394d792007-06-05 20:53:16 +0000315 RValue EmitExprWithUsualUnaryConversions(const Expr *E, QualType &ResTy);
Chris Lattnercf250242007-06-03 02:02:44 +0000316 QualType EmitUsualArithmeticConversions(const BinaryOperator *E,
Chris Lattner8394d792007-06-05 20:53:16 +0000317 RValue &LHS, RValue &RHS);
Chris Lattner47c247e2007-06-29 17:26:27 +0000318 void EmitShiftOperands(const BinaryOperator *E, RValue &LHS, RValue &RHS);
319
Chris Lattnercd215f02007-06-29 16:52:55 +0000320 void EmitCompoundAssignmentOperands(const CompoundAssignOperator *CAO,
321 LValue &LHSLV, RValue &LHS, RValue &RHS);
322 RValue EmitCompoundAssignmentResult(const CompoundAssignOperator *E,
323 LValue LHSLV, RValue ResV);
324
325
Chris Lattner8394d792007-06-05 20:53:16 +0000326 RValue EmitExpr(const Expr *E);
327 RValue EmitIntegerLiteral(const IntegerLiteral *E);
Chris Lattner2ada32e2007-07-09 23:03:16 +0000328 RValue EmitFloatingLiteral(const FloatingLiteral *E);
Chris Lattner6e9d9b32007-07-13 05:18:11 +0000329 RValue EmitCharacterLiteral(const CharacterLiteral *E);
330
Chris Lattner388cf762007-07-13 20:25:53 +0000331 RValue EmitCastExpr(const Expr *Op, QualType DestTy);
Chris Lattner2b228c92007-06-15 21:34:29 +0000332 RValue EmitCallExpr(const CallExpr *E);
Chris Lattnera779b3d2007-07-10 21:58:36 +0000333 RValue EmitArraySubscriptExprRV(const ArraySubscriptExpr *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000334
Chris Lattnerf0106d22007-06-02 19:33:17 +0000335 // Unary Operators.
Chris Lattner8394d792007-06-05 20:53:16 +0000336 RValue EmitUnaryOperator(const UnaryOperator *E);
Chris Lattnerdcca4872007-07-11 23:43:46 +0000337 RValue EmitUnaryIncDec (const UnaryOperator *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000338 RValue EmitUnaryAddrOf (const UnaryOperator *E);
339 RValue EmitUnaryPlus (const UnaryOperator *E);
340 RValue EmitUnaryMinus (const UnaryOperator *E);
341 RValue EmitUnaryNot (const UnaryOperator *E);
342 RValue EmitUnaryLNot (const UnaryOperator *E);
343 // FIXME: SIZEOF/ALIGNOF(expr).
344 // FIXME: real/imag
Chris Lattnerf0106d22007-06-02 19:33:17 +0000345
Chris Lattnerdb91b162007-06-02 00:16:28 +0000346 // Binary Operators.
Chris Lattner8394d792007-06-05 20:53:16 +0000347 RValue EmitBinaryOperator(const BinaryOperator *E);
348 RValue EmitBinaryMul(const BinaryOperator *E);
349 RValue EmitBinaryDiv(const BinaryOperator *E);
350 RValue EmitBinaryRem(const BinaryOperator *E);
Chris Lattnerb25a9432007-06-29 17:03:06 +0000351 RValue EmitMul(RValue LHS, RValue RHS, QualType EltTy);
352 RValue EmitDiv(RValue LHS, RValue RHS, QualType EltTy);
353 RValue EmitRem(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnercd215f02007-06-29 16:52:55 +0000354 RValue EmitAdd(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnerd2b88ab2007-07-13 03:05:23 +0000355 RValue EmitPointerAdd(RValue LHS, QualType LHSTy,
356 RValue RHS, QualType RHSTy, QualType EltTy);
Chris Lattnercd215f02007-06-29 16:52:55 +0000357 RValue EmitSub(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnerd2b88ab2007-07-13 03:05:23 +0000358 RValue EmitPointerSub(RValue LHS, QualType LHSTy,
359 RValue RHS, QualType RHSTy, QualType EltTy);
Chris Lattner47c247e2007-06-29 17:26:27 +0000360 RValue EmitShl(RValue LHS, RValue RHS, QualType ResTy);
361 RValue EmitShr(RValue LHS, RValue RHS, QualType ResTy);
Chris Lattner1fde0b32007-06-20 18:30:55 +0000362 RValue EmitBinaryCompare(const BinaryOperator *E, unsigned UICmpOpc,
363 unsigned SICmpOpc, unsigned FCmpOpc);
Chris Lattnerb25a9432007-06-29 17:03:06 +0000364 RValue EmitAnd(RValue LHS, RValue RHS, QualType EltTy);
365 RValue EmitOr (RValue LHS, RValue RHS, QualType EltTy);
366 RValue EmitXor(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattner8394d792007-06-05 20:53:16 +0000367 RValue EmitBinaryLAnd(const BinaryOperator *E);
368 RValue EmitBinaryLOr(const BinaryOperator *E);
369
370 RValue EmitBinaryAssign(const BinaryOperator *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000371 RValue EmitBinaryComma(const BinaryOperator *E);
Chris Lattner6e9d9b32007-07-13 05:18:11 +0000372
373 // Conditional Operator.
374 RValue EmitConditionalOperator(const ConditionalOperator *E);
Chris Lattnerbed31442007-05-28 01:07:47 +0000375};
376} // end namespace CodeGen
377} // end namespace clang
Chris Lattnerbed31442007-05-28 01:07:47 +0000378
379#endif