llvm.org GIT mirror llvm / a032454
Add upport for bitcast in the C API echo test git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261177 91177308-0d34-0410-b5e6-96231b3b80d8 Amaury Sechet 4 years ago
1 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
275275 if (LLVMIsUndef(Cst))
276276 return LLVMGetUndef(TypeCloner(M).Clone(Cst));
277277
278 // Try float literal
279 if (LLVMIsAConstantFP(Cst))
280 report_fatal_error("ConstantFP is not supported");
281
278282 // This kind of constant is not supported
279283 if (!LLVMIsAConstantExpr(Cst))
280284 report_fatal_error("Expected a constant expression");
281285
282286 // At this point, it must be a constant expression
283 report_fatal_error("ConstantExpression are not supported");
287 LLVMOpcode Op = LLVMGetConstOpcode(Cst);
288 switch(Op) {
289 case LLVMBitCast:
290 return LLVMConstBitCast(clone_constant(LLVMGetOperand(Cst, 0), M),
291 TypeCloner(M).Clone(Cst));
292 default:
293 fprintf(stderr, "%d is not a supported opcode\n", Op);
294 exit(-1);
295 }
284296 }
285297
286298 struct FunCloner {
488500 Dst = LLVMBuildGEP(Builder, Ptr, Idx.data(), NumIdx, Name);
489501 break;
490502 }
503 case LLVMBitCast: {
504 LLVMValueRef V = CloneValue(LLVMGetOperand(Src, 0));
505 Dst = LLVMBuildBitCast(Builder, V, CloneType(Src), Name);
506 break;
507 }
491508 case LLVMICmp: {
492509 LLVMIntPredicate Pred = LLVMGetICmpPredicate(Src);
493510 LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0));