Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57335 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2008-10-10 00:24:54 +00:00
Родитель 0b0ee502fc
Коммит f02e9ddf5e
2 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -382,14 +382,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
}
// See if we have a target specific builtin that needs to be lowered.
Value *V = 0;
if (strcmp(TargetPrefix, "x86") == 0)
V = EmitX86BuiltinExpr(BuiltinID, E);
else if (strcmp(TargetPrefix, "ppc") == 0)
V = EmitPPCBuiltinExpr(BuiltinID, E);
if (V)
if (Value *V = EmitTargetBuiltinExpr(BuiltinID, E))
return RValue::get(V);
ErrorUnsupported(E, "builtin function");
@ -400,6 +393,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
return RValue::get(UndefValue::get(ConvertType(E->getType())));
}
Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
const char *TargetPrefix = Target.getTargetPrefix();
if (strcmp(TargetPrefix, "x86") == 0)
return EmitX86BuiltinExpr(BuiltinID, E);
else if (strcmp(TargetPrefix, "ppc") == 0)
return EmitPPCBuiltinExpr(BuiltinID, E);
return 0;
}
Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {

Просмотреть файл

@ -418,6 +418,10 @@ public:
RValue EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
/// EmitTargetBuiltinExpr - Emit the given builtin call. Returns 0
/// if the call is unhandled by the current target.
llvm::Value *EmitTargetBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
llvm::Value *EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E);
llvm::Value *EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E);