Search in sources :

Example 1 with GetElementPointerConstant

use of com.oracle.truffle.llvm.parser.model.symbols.constants.GetElementPointerConstant in project graal by oracle.

the class LLVMParser method defineAlias.

private void defineAlias(String aliasName, boolean isAliasExported, SymbolImpl value, DataLayout targetDataLayout) {
    if (value instanceof FunctionSymbol) {
        FunctionSymbol function = (FunctionSymbol) value;
        defineAlias(function.getName(), aliasName, isAliasExported);
    } else if (value instanceof GlobalVariable) {
        GlobalVariable global = (GlobalVariable) value;
        defineAlias(global.getName(), aliasName, isAliasExported);
    } else if (value instanceof GlobalAlias) {
        GlobalAlias target = (GlobalAlias) value;
        defineAlias(target, targetDataLayout);
        defineAlias(target.getName(), aliasName, isAliasExported);
    } else if (value instanceof CastConstant) {
        // TODO (chaeubl): this is not perfectly accurate as we are loosing the type cast
        CastConstant cast = (CastConstant) value;
        defineAlias(aliasName, isAliasExported, cast.getValue(), targetDataLayout);
    } else if (value instanceof GetElementPointerConstant) {
        GetElementPointerConstant elementPointerConstant = (GetElementPointerConstant) value;
        defineExpressionSymbol(aliasName, isAliasExported, elementPointerConstant, targetDataLayout);
    } else {
        throw new LLVMLinkerException("Unknown alias type: " + value.getClass());
    }
}
Also used : GlobalVariable(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable) FunctionSymbol(com.oracle.truffle.llvm.parser.model.functions.FunctionSymbol) GetElementPointerConstant(com.oracle.truffle.llvm.parser.model.symbols.constants.GetElementPointerConstant) GlobalAlias(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalAlias) CastConstant(com.oracle.truffle.llvm.parser.model.symbols.constants.CastConstant) LLVMLinkerException(com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)

Aggregations

FunctionSymbol (com.oracle.truffle.llvm.parser.model.functions.FunctionSymbol)1 CastConstant (com.oracle.truffle.llvm.parser.model.symbols.constants.CastConstant)1 GetElementPointerConstant (com.oracle.truffle.llvm.parser.model.symbols.constants.GetElementPointerConstant)1 GlobalAlias (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalAlias)1 GlobalVariable (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalVariable)1 LLVMLinkerException (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)1