blob: 7479743ec3d8568154a2baa377532d3b27cb9237 [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 Lattner308f4312007-05-29 23:50:05 +000018#include "llvm/Support/LLVMBuilder.h"
Chris Lattner2ccb73b2007-06-16 00:16:26 +000019#include <vector>
Chris Lattner308f4312007-05-29 23:50:05 +000020
Chris Lattnerbed31442007-05-28 01:07:47 +000021namespace llvm {
22 class Module;
Chris Lattner23b7eb62007-06-15 23:05:46 +000023}
24
Chris Lattnerbed31442007-05-28 01:07:47 +000025namespace clang {
26 class ASTContext;
Chris Lattner84915fa2007-06-02 04:16:21 +000027 class Decl;
Chris Lattnerbed31442007-05-28 01:07:47 +000028 class FunctionDecl;
Chris Lattner2ccb73b2007-06-16 00:16:26 +000029 class TargetInfo;
Chris Lattner2ccb73b2007-06-16 00:16:26 +000030 class QualType;
31 class FunctionTypeProto;
Chris Lattner84915fa2007-06-02 04:16:21 +000032
Chris Lattner308f4312007-05-29 23:50:05 +000033 class Stmt;
34 class CompoundStmt;
Chris Lattnerac248202007-05-30 00:13:02 +000035 class LabelStmt;
36 class GotoStmt;
Chris Lattner5269c032007-05-30 21:03:58 +000037 class IfStmt;
Chris Lattner946aa312007-06-05 03:59:43 +000038 class WhileStmt;
Chris Lattner8394d792007-06-05 20:53:16 +000039 class DoStmt;
40 class ForStmt;
Chris Lattner3f3dbee2007-06-02 03:19:07 +000041 class ReturnStmt;
Chris Lattner84915fa2007-06-02 04:16:21 +000042 class DeclStmt;
Chris Lattnerbed31442007-05-28 01:07:47 +000043
Chris Lattner208ae962007-05-30 17:57:17 +000044 class Expr;
Chris Lattnerd7f58862007-06-02 05:24:33 +000045 class DeclRefExpr;
Chris Lattner4347e3692007-06-06 04:54:52 +000046 class StringLiteral;
Chris Lattner208ae962007-05-30 17:57:17 +000047 class IntegerLiteral;
Chris Lattner2ada32e2007-07-09 23:03:16 +000048 class FloatingLiteral;
Chris Lattner6e9d9b32007-07-13 05:18:11 +000049 class CharacterLiteral;
Chris Lattner8394d792007-06-05 20:53:16 +000050 class CastExpr;
Chris Lattner2b228c92007-06-15 21:34:29 +000051 class CallExpr;
Chris Lattnerf0106d22007-06-02 19:33:17 +000052 class UnaryOperator;
Chris Lattnerdb91b162007-06-02 00:16:28 +000053 class BinaryOperator;
Chris Lattner9369a562007-06-29 16:31:29 +000054 class CompoundAssignOperator;
Chris Lattnerd9d2fb12007-06-08 23:31:14 +000055 class ArraySubscriptExpr;
Chris Lattner6e9d9b32007-07-13 05:18:11 +000056 class ConditionalOperator;
Chris Lattner208ae962007-05-30 17:57:17 +000057
Chris Lattner84915fa2007-06-02 04:16:21 +000058 class BlockVarDecl;
59 class EnumConstantDecl;
Chris Lattner53621a52007-06-13 20:44:40 +000060 class ParmVarDecl;
Chris Lattnerbed31442007-05-28 01:07:47 +000061namespace CodeGen {
62 class CodeGenModule;
63
Chris Lattnerd7f58862007-06-02 05:24:33 +000064
Chris Lattner8394d792007-06-05 20:53:16 +000065/// RValue - This trivial value class is used to represent the result of an
Chris Lattnerd7f58862007-06-02 05:24:33 +000066/// expression that is evaluated. It can be one of two things: either a simple
67/// LLVM SSA value, or the address of an aggregate value in memory. These two
68/// possibilities are discriminated by isAggregate/isScalar.
Chris Lattner8394d792007-06-05 20:53:16 +000069class RValue {
Chris Lattner23b7eb62007-06-15 23:05:46 +000070 llvm::Value *V;
Chris Lattnerdb91b162007-06-02 00:16:28 +000071 // TODO: Encode this into the low bit of pointer for more efficient
72 // return-by-value.
Chris Lattner5269c032007-05-30 21:03:58 +000073 bool IsAggregate;
Chris Lattner09153c02007-06-22 18:48:09 +000074
75 // FIXME: Aggregate rvalues need to retain information about whether they are
76 // volatile or not.
Chris Lattner5269c032007-05-30 21:03:58 +000077public:
78
79 bool isAggregate() const { return IsAggregate; }
80 bool isScalar() const { return !IsAggregate; }
81
82 /// getVal() - Return the Value* of this scalar value.
Chris Lattner23b7eb62007-06-15 23:05:46 +000083 llvm::Value *getVal() const {
Chris Lattner5269c032007-05-30 21:03:58 +000084 assert(!isAggregate() && "Not a scalar!");
85 return V;
86 }
87
Chris Lattner09153c02007-06-22 18:48:09 +000088 /// getAggregateAddr() - Return the Value* of the address of the aggregate.
89 llvm::Value *getAggregateAddr() const {
Chris Lattner5269c032007-05-30 21:03:58 +000090 assert(isAggregate() && "Not an aggregate!");
91 return V;
92 }
Chris Lattner208ae962007-05-30 17:57:17 +000093
Chris Lattner23b7eb62007-06-15 23:05:46 +000094 static RValue get(llvm::Value *V) {
Chris Lattner8394d792007-06-05 20:53:16 +000095 RValue ER;
Chris Lattner208ae962007-05-30 17:57:17 +000096 ER.V = V;
Chris Lattner5269c032007-05-30 21:03:58 +000097 ER.IsAggregate = false;
Chris Lattner208ae962007-05-30 17:57:17 +000098 return ER;
99 }
Chris Lattner23b7eb62007-06-15 23:05:46 +0000100 static RValue getAggregate(llvm::Value *V) {
Chris Lattner8394d792007-06-05 20:53:16 +0000101 RValue ER;
Chris Lattner208ae962007-05-30 17:57:17 +0000102 ER.V = V;
Chris Lattner5269c032007-05-30 21:03:58 +0000103 ER.IsAggregate = true;
Chris Lattner208ae962007-05-30 17:57:17 +0000104 return ER;
105 }
106};
Chris Lattnerd7f58862007-06-02 05:24:33 +0000107
108
109/// LValue - This represents an lvalue references. Because C/C++ allow
110/// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a
111/// bitrange.
112class LValue {
113 // FIXME: Volatility. Restrict?
Chris Lattner8394d792007-06-05 20:53:16 +0000114 // alignment?
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000115
116 enum {
117 Simple, // This is a normal l-value, use getAddress().
118 VectorElt, // This is a vector element l-value (V[i]), use getVector*
119 BitField // This is a bitfield l-value, use getBitfield*.
120 } LVType;
121
Chris Lattnerd7f58862007-06-02 05:24:33 +0000122 llvm::Value *V;
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000123
124 union {
125 llvm::Value *VectorIdx;
126 };
Chris Lattnerd7f58862007-06-02 05:24:33 +0000127public:
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000128 bool isSimple() const { return LVType == Simple; }
129 bool isVectorElt() const { return LVType == VectorElt; }
130 bool isBitfield() const { return LVType == BitField; }
Chris Lattner208ae962007-05-30 17:57:17 +0000131
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000132 // simple lvalue
133 llvm::Value *getAddress() const { assert(isSimple()); return V; }
134 // vector elt lvalue
135 llvm::Value *getVectorAddr() const { assert(isVectorElt()); return V; }
136 llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; }
Chris Lattnerd7f58862007-06-02 05:24:33 +0000137
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000138 static LValue MakeAddr(llvm::Value *V) {
Chris Lattnerd7f58862007-06-02 05:24:33 +0000139 LValue R;
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000140 R.LVType = Simple;
Chris Lattnerd7f58862007-06-02 05:24:33 +0000141 R.V = V;
142 return R;
143 }
Chris Lattner08c4b9f2007-07-10 21:17:59 +0000144
145 static LValue MakeVectorElt(llvm::Value *Vec, llvm::Value *Idx) {
146 LValue R;
147 R.LVType = VectorElt;
148 R.V = Vec;
149 R.VectorIdx = Idx;
150 return R;
151 }
152
Chris Lattnerd7f58862007-06-02 05:24:33 +0000153};
154
Chris Lattnerbed31442007-05-28 01:07:47 +0000155/// CodeGenFunction - This class organizes the per-function state that is used
156/// while generating LLVM code.
157class CodeGenFunction {
158 CodeGenModule &CGM; // Per-module state.
Chris Lattnerd1af2d22007-05-29 23:17:50 +0000159 TargetInfo &Target;
Chris Lattner23b7eb62007-06-15 23:05:46 +0000160 llvm::LLVMBuilder Builder;
Chris Lattner3f3dbee2007-06-02 03:19:07 +0000161
162 const FunctionDecl *CurFuncDecl;
Chris Lattnerac248202007-05-30 00:13:02 +0000163 llvm::Function *CurFn;
164
Chris Lattner03df1222007-06-02 04:53:11 +0000165 /// AllocaInsertPoint - This is an instruction in the entry block before which
166 /// we prefer to insert allocas.
167 llvm::Instruction *AllocaInsertPt;
168
Chris Lattner6db1fb82007-06-02 22:49:07 +0000169 const llvm::Type *LLVMIntTy;
Chris Lattnerd9d2fb12007-06-08 23:31:14 +0000170 unsigned LLVMPointerWidth;
Chris Lattner6db1fb82007-06-02 22:49:07 +0000171
Chris Lattner84915fa2007-06-02 04:16:21 +0000172 /// LocalDeclMap - This keeps track of the LLVM allocas or globals for local C
173 /// decls.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000174 llvm::DenseMap<const Decl*, llvm::Value*> LocalDeclMap;
Chris Lattner84915fa2007-06-02 04:16:21 +0000175
Chris Lattnerac248202007-05-30 00:13:02 +0000176 /// LabelMap - This keeps track of the LLVM basic block for each C label.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000177 llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
Chris Lattnerbed31442007-05-28 01:07:47 +0000178public:
Chris Lattnerd1af2d22007-05-29 23:17:50 +0000179 CodeGenFunction(CodeGenModule &cgm);
Chris Lattnerbed31442007-05-28 01:07:47 +0000180
Chris Lattner6db1fb82007-06-02 22:49:07 +0000181 ASTContext &getContext() const;
182
Chris Lattner308f4312007-05-29 23:50:05 +0000183 void GenerateCode(const FunctionDecl *FD);
184
Chris Lattnerf033c142007-06-22 19:05:19 +0000185 const llvm::Type *ConvertType(QualType T);
Chris Lattnerac248202007-05-30 00:13:02 +0000186
Chris Lattner54fb19e2007-06-22 22:02:34 +0000187 /// hasAggregateLLVMType - Return true if the specified AST type will map into
188 /// an aggregate LLVM type or is void.
189 static bool hasAggregateLLVMType(QualType T);
190
Chris Lattnerac248202007-05-30 00:13:02 +0000191 /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
192 /// label maps to.
193 llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
194
195
Chris Lattner23b7eb62007-06-15 23:05:46 +0000196 void EmitBlock(llvm::BasicBlock *BB);
Chris Lattner84915fa2007-06-02 04:16:21 +0000197
Chris Lattnere9a64532007-06-22 21:44:33 +0000198 //===--------------------------------------------------------------------===//
199 // Helpers
200 //===--------------------------------------------------------------------===//
201
202 /// CreateTempAlloca - This creates a alloca and inserts it into the entry
203 /// block.
204 llvm::AllocaInst *CreateTempAlloca(const llvm::Type *Ty,
205 const char *Name = "tmp");
206
Chris Lattner8394d792007-06-05 20:53:16 +0000207 /// EvaluateExprAsBool - Perform the usual unary conversions on the specified
208 /// expression and compare the result against zero, returning an Int1Ty value.
Chris Lattner23b7eb62007-06-15 23:05:46 +0000209 llvm::Value *EvaluateExprAsBool(const Expr *E);
Chris Lattnere9a64532007-06-22 21:44:33 +0000210
Chris Lattnerac248202007-05-30 00:13:02 +0000211
Chris Lattnere9a64532007-06-22 21:44:33 +0000212 /// EmitLoadOfComplex - Given an RValue reference for a complex, emit code to
213 /// load the real and imaginary pieces, returning them as Real/Imag.
214 void EmitLoadOfComplex(RValue V, llvm::Value *&Real, llvm::Value *&Imag);
215
216 /// EmitStoreOfComplex - Store the specified real/imag parts into the
217 /// specified value pointer.
218 void EmitStoreOfComplex(llvm::Value *Real, llvm::Value *Imag,
219 llvm::Value *ResPtr);
220
Chris Lattner8394d792007-06-05 20:53:16 +0000221 //===--------------------------------------------------------------------===//
222 // Conversions
223 //===--------------------------------------------------------------------===//
224
225 /// EmitConversion - Convert the value specied by Val, whose type is ValTy, to
226 /// the type specified by DstTy, following the rules of C99 6.3.
Chris Lattnerf033c142007-06-22 19:05:19 +0000227 RValue EmitConversion(RValue Val, QualType ValTy, QualType DstTy);
Chris Lattner8394d792007-06-05 20:53:16 +0000228
229 /// ConvertScalarValueToBool - Convert the specified expression value to a
Chris Lattnerf0106d22007-06-02 19:33:17 +0000230 /// boolean (i1) truth value. This is equivalent to "Val == 0".
Chris Lattner23b7eb62007-06-15 23:05:46 +0000231 llvm::Value *ConvertScalarValueToBool(RValue Val, QualType Ty);
Chris Lattnerf0106d22007-06-02 19:33:17 +0000232
Chris Lattner308f4312007-05-29 23:50:05 +0000233 //===--------------------------------------------------------------------===//
Chris Lattner53621a52007-06-13 20:44:40 +0000234 // Declaration Emission
Chris Lattner84915fa2007-06-02 04:16:21 +0000235 //===--------------------------------------------------------------------===//
236
Chris Lattner1ad38f82007-06-09 01:20:56 +0000237 void EmitDecl(const Decl &D);
Chris Lattner84915fa2007-06-02 04:16:21 +0000238 void EmitEnumConstantDecl(const EnumConstantDecl &D);
Chris Lattner03df1222007-06-02 04:53:11 +0000239 void EmitBlockVarDecl(const BlockVarDecl &D);
240 void EmitLocalBlockVarDecl(const BlockVarDecl &D);
Chris Lattner53621a52007-06-13 20:44:40 +0000241 void EmitParmDecl(const ParmVarDecl &D, llvm::Value *Arg);
Chris Lattner03df1222007-06-02 04:53:11 +0000242
Chris Lattner84915fa2007-06-02 04:16:21 +0000243 //===--------------------------------------------------------------------===//
Chris Lattner308f4312007-05-29 23:50:05 +0000244 // Statement Emission
245 //===--------------------------------------------------------------------===//
246
247 void EmitStmt(const Stmt *S);
248 void EmitCompoundStmt(const CompoundStmt &S);
Chris Lattnerac248202007-05-30 00:13:02 +0000249 void EmitLabelStmt(const LabelStmt &S);
250 void EmitGotoStmt(const GotoStmt &S);
Chris Lattner5269c032007-05-30 21:03:58 +0000251 void EmitIfStmt(const IfStmt &S);
Chris Lattner946aa312007-06-05 03:59:43 +0000252 void EmitWhileStmt(const WhileStmt &S);
Chris Lattner8394d792007-06-05 20:53:16 +0000253 void EmitDoStmt(const DoStmt &S);
254 void EmitForStmt(const ForStmt &S);
Chris Lattner3f3dbee2007-06-02 03:19:07 +0000255 void EmitReturnStmt(const ReturnStmt &S);
Chris Lattner1ad38f82007-06-09 01:20:56 +0000256 void EmitDeclStmt(const DeclStmt &S);
257
Chris Lattner208ae962007-05-30 17:57:17 +0000258 //===--------------------------------------------------------------------===//
Chris Lattnerd7f58862007-06-02 05:24:33 +0000259 // LValue Expression Emission
260 //===--------------------------------------------------------------------===//
Chris Lattner8394d792007-06-05 20:53:16 +0000261
262 /// EmitLValue - Emit code to compute a designator that specifies the location
263 /// of the expression.
264 ///
265 /// This can return one of two things: a simple address or a bitfield
266 /// reference. In either case, the LLVM Value* in the LValue structure is
267 /// guaranteed to be an LLVM pointer type.
268 ///
269 /// If this returns a bitfield reference, nothing about the pointee type of
270 /// the LLVM value is known: For example, it may not be a pointer to an
271 /// integer.
272 ///
273 /// If this returns a normal address, and if the lvalue's C type is fixed
274 /// size, this method guarantees that the returned pointer type will point to
275 /// an LLVM type of the same size of the lvalue's type. If the lvalue has a
276 /// variable length type, this is not possible.
277 ///
Chris Lattnerd7f58862007-06-02 05:24:33 +0000278 LValue EmitLValue(const Expr *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000279
280 /// EmitLoadOfLValue - Given an expression that represents a value lvalue,
281 /// this method emits the address of the lvalue, then loads the result as an
282 /// rvalue, returning the rvalue.
283 RValue EmitLoadOfLValue(const Expr *E);
Chris Lattner9369a562007-06-29 16:31:29 +0000284 RValue EmitLoadOfLValue(LValue V, QualType LVType);
285
Chris Lattner8394d792007-06-05 20:53:16 +0000286 /// EmitStoreThroughLValue - Store the specified rvalue into the specified
287 /// lvalue, where both are guaranteed to the have the same type, and that type
288 /// is 'Ty'.
289 void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
290
Chris Lattnerd7f58862007-06-02 05:24:33 +0000291 LValue EmitDeclRefLValue(const DeclRefExpr *E);
Chris Lattner4347e3692007-06-06 04:54:52 +0000292 LValue EmitStringLiteralLValue(const StringLiteral *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000293 LValue EmitUnaryOpLValue(const UnaryOperator *E);
Chris Lattnerd9d2fb12007-06-08 23:31:14 +0000294 LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E);
Chris Lattnerd7f58862007-06-02 05:24:33 +0000295
296 //===--------------------------------------------------------------------===//
Chris Lattner208ae962007-05-30 17:57:17 +0000297 // Expression Emission
298 //===--------------------------------------------------------------------===//
299
Chris Lattner8394d792007-06-05 20:53:16 +0000300 RValue EmitExprWithUsualUnaryConversions(const Expr *E, QualType &ResTy);
Chris Lattnercf250242007-06-03 02:02:44 +0000301 QualType EmitUsualArithmeticConversions(const BinaryOperator *E,
Chris Lattner8394d792007-06-05 20:53:16 +0000302 RValue &LHS, RValue &RHS);
Chris Lattner47c247e2007-06-29 17:26:27 +0000303 void EmitShiftOperands(const BinaryOperator *E, RValue &LHS, RValue &RHS);
304
Chris Lattnercd215f02007-06-29 16:52:55 +0000305 void EmitCompoundAssignmentOperands(const CompoundAssignOperator *CAO,
306 LValue &LHSLV, RValue &LHS, RValue &RHS);
307 RValue EmitCompoundAssignmentResult(const CompoundAssignOperator *E,
308 LValue LHSLV, RValue ResV);
309
310
Chris Lattner8394d792007-06-05 20:53:16 +0000311 RValue EmitExpr(const Expr *E);
312 RValue EmitIntegerLiteral(const IntegerLiteral *E);
Chris Lattner2ada32e2007-07-09 23:03:16 +0000313 RValue EmitFloatingLiteral(const FloatingLiteral *E);
Chris Lattner6e9d9b32007-07-13 05:18:11 +0000314 RValue EmitCharacterLiteral(const CharacterLiteral *E);
315
Chris Lattner388cf762007-07-13 20:25:53 +0000316 RValue EmitCastExpr(const Expr *Op, QualType DestTy);
Chris Lattner2b228c92007-06-15 21:34:29 +0000317 RValue EmitCallExpr(const CallExpr *E);
Chris Lattnera779b3d2007-07-10 21:58:36 +0000318 RValue EmitArraySubscriptExprRV(const ArraySubscriptExpr *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000319
Chris Lattnerf0106d22007-06-02 19:33:17 +0000320 // Unary Operators.
Chris Lattner8394d792007-06-05 20:53:16 +0000321 RValue EmitUnaryOperator(const UnaryOperator *E);
Chris Lattnerdcca4872007-07-11 23:43:46 +0000322 RValue EmitUnaryIncDec (const UnaryOperator *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000323 RValue EmitUnaryAddrOf (const UnaryOperator *E);
324 RValue EmitUnaryPlus (const UnaryOperator *E);
325 RValue EmitUnaryMinus (const UnaryOperator *E);
326 RValue EmitUnaryNot (const UnaryOperator *E);
327 RValue EmitUnaryLNot (const UnaryOperator *E);
328 // FIXME: SIZEOF/ALIGNOF(expr).
329 // FIXME: real/imag
Chris Lattnerf0106d22007-06-02 19:33:17 +0000330
Chris Lattnerdb91b162007-06-02 00:16:28 +0000331 // Binary Operators.
Chris Lattner8394d792007-06-05 20:53:16 +0000332 RValue EmitBinaryOperator(const BinaryOperator *E);
333 RValue EmitBinaryMul(const BinaryOperator *E);
334 RValue EmitBinaryDiv(const BinaryOperator *E);
335 RValue EmitBinaryRem(const BinaryOperator *E);
Chris Lattnerb25a9432007-06-29 17:03:06 +0000336 RValue EmitMul(RValue LHS, RValue RHS, QualType EltTy);
337 RValue EmitDiv(RValue LHS, RValue RHS, QualType EltTy);
338 RValue EmitRem(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnercd215f02007-06-29 16:52:55 +0000339 RValue EmitAdd(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnerd2b88ab2007-07-13 03:05:23 +0000340 RValue EmitPointerAdd(RValue LHS, QualType LHSTy,
341 RValue RHS, QualType RHSTy, QualType EltTy);
Chris Lattnercd215f02007-06-29 16:52:55 +0000342 RValue EmitSub(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattnerd2b88ab2007-07-13 03:05:23 +0000343 RValue EmitPointerSub(RValue LHS, QualType LHSTy,
344 RValue RHS, QualType RHSTy, QualType EltTy);
Chris Lattner47c247e2007-06-29 17:26:27 +0000345 RValue EmitShl(RValue LHS, RValue RHS, QualType ResTy);
346 RValue EmitShr(RValue LHS, RValue RHS, QualType ResTy);
Chris Lattner1fde0b32007-06-20 18:30:55 +0000347 RValue EmitBinaryCompare(const BinaryOperator *E, unsigned UICmpOpc,
348 unsigned SICmpOpc, unsigned FCmpOpc);
Chris Lattnerb25a9432007-06-29 17:03:06 +0000349 RValue EmitAnd(RValue LHS, RValue RHS, QualType EltTy);
350 RValue EmitOr (RValue LHS, RValue RHS, QualType EltTy);
351 RValue EmitXor(RValue LHS, RValue RHS, QualType EltTy);
Chris Lattner8394d792007-06-05 20:53:16 +0000352 RValue EmitBinaryLAnd(const BinaryOperator *E);
353 RValue EmitBinaryLOr(const BinaryOperator *E);
354
355 RValue EmitBinaryAssign(const BinaryOperator *E);
Chris Lattner8394d792007-06-05 20:53:16 +0000356 RValue EmitBinaryComma(const BinaryOperator *E);
Chris Lattner6e9d9b32007-07-13 05:18:11 +0000357
358 // Conditional Operator.
359 RValue EmitConditionalOperator(const ConditionalOperator *E);
Chris Lattnerbed31442007-05-28 01:07:47 +0000360};
361} // end namespace CodeGen
362} // end namespace clang
Chris Lattnerbed31442007-05-28 01:07:47 +0000363
364#endif