projects/p3/C/licm.c
LLVMBool canMoveOutOfLoop(LLVMLoopRef L, LLVMValueRef I, worklist_t store_addr)
{
    LLVMValueRef addr = LLVMGetOperand(I, 0);
    if(LLVMGetVolatile(I)) return (LLVMBool)0;
    // check if there is no possible store to addr in the loop
    if(worklist_include(store_addr, addr)) return (LLVMBool)0;
    if(LLVMIsAGlobalVariable(addr)) return (LLVMBool)1;
    if(LLVMIsAAllocaInst(addr)) return (LLVMBool)1;
    return (LLVMBool)0;
}
// check if the load instruction in the loop can be moved out of the loop
check if the load instruction in the loop can be moved out of the loop
check if the load instruction in the loop can be moved out of the loop
LLVMBool canMoveOutOfLoop(LLVMLoopRef L, LLVMValueRef I, worklist_t store_addr)
{
    LLVMValueRef addr = LLVMGetOperand(I, 0);
    if(LLVMGetVolatile(I)) return (LLVMBool)0;
    if(worklist_include(store_addr, addr)) return (LLVMBool)0;
    if(LLVMIsAGlobalVariable(addr)) return (LLVMBool)1;
    if(LLVMIsAAllocaInst(addr)) return (LLVMBool)1;
    return (LLVMBool)0;
}
LLVMBool canMoveOutOfLoop ( LLVMLoopRef L , LLVMValueRef I , worklist_t store_addr ) { LLVMValueRef addr = LLVMGetOperand ( I , 0 ) ; if ( LLVMGetVolatile ( I ) ) return ( LLVMBool ) 0 ; if ( worklist_include ( store_addr , addr ) ) return ( LLVMBool ) 0 ; if ( LLVMIsAGlobalVariable ( addr ) ) return ( LLVMBool ) 1 ; if ( LLVMIsAAllocaInst ( addr ) ) return ( LLVMBool ) 1 ; return ( LLVMBool ) 0 ; }
check if the load instruction in the loop can be moved out of the loop
check if the load instruction in the loop can be moved out of the loop
// check if there is no possible store to addr in the loop