Beispiel #1
0
from binding import *
from src.namespace import llvm

TargetMachine = llvm.Class()

from src.Support.TargetRegistry import Target
from src.ADT.StringRef import StringRef
from src.Support.CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
from src.GlobalValue import GlobalValue
from src.DataLayout import DataLayout
from src.TargetTransformInfo import (ScalarTargetTransformInfo,
                                     VectorTargetTransformInfo)
from src.PassManager import PassManagerBase
from src.Support.FormattedStream import formatted_raw_ostream


@TargetMachine
class TargetMachine:
    _include_ = 'llvm/Target/TargetMachine.h'

    CodeGenFileType = Enum('''
                           CGFT_AssemblyFile
                           CGFT_ObjectFile
                           CGFT_Null''')

    delete = Destructor()

    getTarget = Method(const(ref(Target)))

    getTargetTriple = Method(cast(StringRef, str))
    getTargetCPU = Method(cast(StringRef, str))
Beispiel #2
0
from binding import *
from src.namespace import llvm
from src.Pass import ImmutablePass

llvm.includes.add('llvm/TargetTransformInfo.h')

TargetTransformInfo = llvm.Class(ImmutablePass)
ScalarTargetTransformInfo = llvm.Class()
VectorTargetTransformInfo = llvm.Class()


@ScalarTargetTransformInfo
class ScalarTargetTransformInfo:
    delete = Destructor()


@VectorTargetTransformInfo
class VectorTargetTransformInfo:
    delete = Destructor()


@TargetTransformInfo
class TargetTransformInfo:
    new = Constructor(ptr(ScalarTargetTransformInfo),
                      ptr(VectorTargetTransformInfo))
Beispiel #3
0
from binding import *
from src.namespace import llvm

llvm.includes.add('llvm/Transforms/Utils/Cloning.h')

InlineFunctionInfo = llvm.Class()


from src.Module import Module
from src.Instruction import CallInst

@InlineFunctionInfo
class InlineFunctionInfo:
    new = Constructor()
    delete = Destructor()


CloneModule = llvm.Function('CloneModule', ptr(Module), ptr(Module))

InlineFunction = llvm.Function('InlineFunction',
                               cast(Bool, bool),    # bool --- failed
                               ptr(CallInst),
                               ref(InlineFunctionInfo),
                               cast(bool, Bool),    # insert lifetime = true
                               ).require_only(2)
Beispiel #4
0
from binding import *
from src.namespace import llvm

llvm.includes.add('llvm/Target/TargetOptions.h')

TargetOptions = llvm.Class()


@TargetOptions
class TargetOptions:
    new = Constructor()
    delete = Destructor()
Beispiel #5
0
from binding import *
from src.namespace import llvm

llvm.includes.add('llvm/Support/TargetRegistry.h')

Target = llvm.Class()
TargetRegistry = llvm.Class()

from src.ADT.Triple import Triple
from src.ADT.StringRef import StringRef
from src.Target.TargetMachine import TargetMachine
from src.Target.TargetOptions import TargetOptions
from src.Support.CodeGen import Reloc, CodeModel, CodeGenOpt

if LLVM_VERSION >= (3, 4):
    from src.MC import MCSubtargetInfo
    from src.MC import MCDisassembler
    from src.MC import MCRegisterInfo
    from src.MC import MCAsmInfo
    from src.MC import MCInstrInfo
    from src.MC import MCInstrAnalysis
    from src.MC import MCInstPrinter


@Target
class Target:
    getNext = Method(const(ownedptr(Target)))

    getName = Method(cast(StdString, str))
    getShortDescription = Method(cast(StdString, str))