mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Add upport for bitcast in the C API echo test
llvm-svn: 261177
This commit is contained in:
parent
1b72e0f1c1
commit
ad1d571d7e
@ -276,12 +276,24 @@ LLVMValueRef clone_constant(LLVMValueRef Cst, LLVMModuleRef M) {
|
||||
if (LLVMIsUndef(Cst))
|
||||
return LLVMGetUndef(TypeCloner(M).Clone(Cst));
|
||||
|
||||
// Try float literal
|
||||
if (LLVMIsAConstantFP(Cst))
|
||||
report_fatal_error("ConstantFP is not supported");
|
||||
|
||||
// This kind of constant is not supported
|
||||
if (!LLVMIsAConstantExpr(Cst))
|
||||
report_fatal_error("Expected a constant expression");
|
||||
|
||||
// At this point, it must be a constant expression
|
||||
report_fatal_error("ConstantExpression are not supported");
|
||||
LLVMOpcode Op = LLVMGetConstOpcode(Cst);
|
||||
switch(Op) {
|
||||
case LLVMBitCast:
|
||||
return LLVMConstBitCast(clone_constant(LLVMGetOperand(Cst, 0), M),
|
||||
TypeCloner(M).Clone(Cst));
|
||||
default:
|
||||
fprintf(stderr, "%d is not a supported opcode\n", Op);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
struct FunCloner {
|
||||
@ -489,6 +501,11 @@ struct FunCloner {
|
||||
Dst = LLVMBuildGEP(Builder, Ptr, Idx.data(), NumIdx, Name);
|
||||
break;
|
||||
}
|
||||
case LLVMBitCast: {
|
||||
LLVMValueRef V = CloneValue(LLVMGetOperand(Src, 0));
|
||||
Dst = LLVMBuildBitCast(Builder, V, CloneType(Src), Name);
|
||||
break;
|
||||
}
|
||||
case LLVMICmp: {
|
||||
LLVMIntPredicate Pred = LLVMGetICmpPredicate(Src);
|
||||
LLVMValueRef LHS = CloneValue(LLVMGetOperand(Src, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user