From 08b09a4a194e26feeaacc3dfbb4637ea1f914708 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 29 Sep 2008 17:32:33 +0200 Subject: LLVM compiler: Cleanups. --- MLKLLVMCompiler.mm | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm index 91d744d..c62610d 100644 --- a/MLKLLVMCompiler.mm +++ b/MLKLLVMCompiler.mm @@ -55,6 +55,7 @@ #include using namespace llvm; +using namespace std; static ExecutionEngine *execution_engine; @@ -141,7 +142,7 @@ static Constant Value *v = NULL; BasicBlock *block; - std::vector noargs (0, Type::VoidTy); + vector noargs (0, Type::VoidTy); FunctionType *function_type = FunctionType::get (VoidPointerTy, noargs, false); @@ -175,7 +176,7 @@ static Constant #if 1 // JIT-compile. - std::vector nogenericargs; + vector nogenericargs; lambdaForm = (id)execution_engine->runFunction (function, nogenericargs).PointerVal; //fn = (id (*)()) execution_engine->getPointerToFunction (function); // Execute. @@ -266,7 +267,7 @@ static Constant +(Value *) insertMethodCall:(NSString *)messageName onObject:(Value *)object - withArgumentVector:(std::vector *)argv + withArgumentVector:(vector *)argv { return [self insertMethodCall:messageName onObject:object @@ -276,7 +277,7 @@ static Constant +(Value *) insertVoidMethodCall:(NSString *)messageName onObject:(Value *)object - withArgumentVector:(std::vector *)argv + withArgumentVector:(vector *)argv { return [self insertMethodCall:messageName onObject:object @@ -287,7 +288,7 @@ static Constant +(Value *) insertMethodCall:(NSString *)messageName onObject:(Value *)object - withArgumentVector:(std::vector *)argv + withArgumentVector:(vector *)argv name:(NSString *)name { return [self insertMethodCall:messageName @@ -299,11 +300,11 @@ static Constant +(Value *) insertMethodCall:(NSString *)messageName onObject:(Value *)object - withArgumentVector:(std::vector *)argv + withArgumentVector:(vector *)argv name:(NSString *)name returnType:(const Type *)returnType { - std::vector argtypes (2, VoidPointerTy); + vector argtypes (2, VoidPointerTy); FunctionType *ftype = FunctionType::get (returnType, argtypes, true); Value *sel = [self insertSelectorLookup:messageName]; @@ -312,7 +313,7 @@ static Constant Constant *function = module->getOrInsertFunction ("objc_msgSend", ftype); #else - std::vector lookup_argtypes (2, VoidPointerTy); + vector lookup_argtypes (2, VoidPointerTy); FunctionType *lookup_ftype = FunctionType::get (PointerType::get (ftype, 0), lookup_argtypes, false); @@ -323,14 +324,14 @@ static Constant #endif // XXX The following doesn't work. Why? - // std::deque argd (*argv); + // deque argd (*argv); // argd.push_front (sel); // argd.push_front (object); - std::vector argd; + vector argd; argd.push_back (object); argd.push_back (sel); - std::vector::iterator e; + vector::iterator e; for (e = argv->begin(); e != argv->end(); e++) argd.push_back (*e); @@ -341,7 +342,7 @@ static Constant onObject:(Value *)object withName:(NSString *)name { - std::vector argv; + vector argv; return [self insertMethodCall:messageName onObject:object withArgumentVector:&argv @@ -499,7 +500,7 @@ static Constant false), VoidPointerTy); - std::vector args (1, symbolV); + vector args (1, symbolV); value = [_compiler insertMethodCall:@"valueForSymbol:" onObject:dynctx withArgumentVector:&args]; @@ -533,7 +534,7 @@ static Constant Value *functionPtr; Value *closureDataCell; Value *closureDataPtr; - std::vector args; + vector args; if (![_context symbolNamesFunction:_head]) { @@ -596,7 +597,7 @@ static Constant @implementation MLKSimpleLambdaForm (MLKLLVMCompilation) -(Value *) reallyProcessForLLVM { - std::vector argtypes (1, PointerPointerTy); + vector argtypes (1, PointerPointerTy); FunctionType *ftype = FunctionType::get (VoidPointerTy, argtypes, true); Function *function = Function::Create (ftype, Function::InternalLinkage, @@ -695,7 +696,7 @@ static Constant builder.SetInsertPoint (lambdaListNewBlock); function->getBasicBlockList().push_back (lambdaListNewBlock); - std::vector argv (1, arg); + vector argv (1, arg); argv.push_back (ConstantPointerNull::get (VoidPointerTy)); Value *newLambdaList = [_compiler insertMethodCall:@"cons:with:" onObject:mlkcons @@ -710,7 +711,7 @@ static Constant Value *newCons = [_compiler insertMethodCall:@"cons:with:" onObject:mlkcons withArgumentVector:&argv]; - std::vector setcdr_argv (1, newCons); + vector setcdr_argv (1, newCons); [_compiler insertVoidMethodCall:@"setCdr:" onObject:builder.CreateLoad(lambdaListTail) withArgumentVector:&setcdr_argv]; @@ -730,7 +731,7 @@ static Constant { Value *mlkbinding = [_compiler insertClassLookup:@"MLKBinding"]; Value *currentLambdaList = builder.CreateLoad (lambdaList); - std::vector args (1, currentLambdaList); + vector args (1, currentLambdaList); Value *lambdaBinding = [_compiler insertMethodCall:@"bindingWithValue:" onObject:mlkbinding withArgumentVector:&args]; @@ -807,7 +808,7 @@ static Constant if ([_bodyContext variableHeapAllocationForSymbol:[binding_form name]]) { Value *mlkbinding = [_compiler insertClassLookup:@"MLKBinding"]; - std::vector args (1, binding_value); + vector args (1, binding_value); Value *binding = [_compiler insertMethodCall:@"bindingWithValue:" onObject:mlkbinding withArgumentVector:&args]; @@ -942,7 +943,7 @@ static Constant false), VoidPointerTy); - std::vector args; + vector args; args.push_back (symbolV); Value *binding = [_compiler insertMethodCall:@"bindingForSymbol:" onObject:dynctx @@ -983,7 +984,7 @@ static Constant else if ([_context variableIsGlobal:variable]) { Value *binding = builder.Insert ([_context globalBindingValueForSymbol:variable]); - std::vector args (1, value); + vector args (1, value); [_compiler insertVoidMethodCall:@"setValue:" onObject:binding @@ -992,7 +993,7 @@ static Constant else if ([_context variableHeapAllocationForSymbol:variable]) { Value *binding = [_context bindingValueForSymbol:variable]; - std::vector args (1, value); + vector args (1, value); [_compiler insertVoidMethodCall:@"setValue:" onObject:binding -- cgit v1.2.3