added tests to testall for llvm.target and llvm.mc

tests dont check for correctness, just exercise the API
This commit is contained in:
anthony cantor 2013-08-18 02:12:28 -06:00 • committed by Siu Kwan Lam
commit 87d444c9e9

View file

@ -619,6 +619,48 @@ def do_llvm_passes():
do_passmanager()
do_functionpassmanager()
def do_llvm_target():
print(" Testing module llvm.target")
from llvm import target
target.initialize_all()
target.print_registered_targets()
target.get_host_cpu_name()
target.get_default_triple()
tm = TargetMachine.new()
tm = TargetMachine.lookup("arm")
tm = TargetMachine.arm()
tm = TargetMachine.thumb()
tm = TargetMachine.x86()
tm = TargetMachine.x86_64()
tm.target_data
tm.target_name
tm.target_short_description
tm.triple
tm.cpu
tm.feature_string
tm.target
if llvm.version >= (3, 4):
tm.reg_info
tm.subtarget_info
tm.asm_info
tm.instr_info
tm.instr_analysis
tm.disassembler
tm.is_little_endian()
def do_llvm_mc():
from llvm import target
from llvm import mc
target.initialize_all()
tm = TargetMachine.x86()
dasm = mc.Disassembler(tm)
for (offset, instr) in dasm.decode("c3"):
pass
def main():
print("Testing package llvm")
@ -626,7 +668,8 @@ def main():
do_llvm_core()
do_llvm_ee()
do_llvm_passes()
do_llvm_target()
do_llvm_mc()
if __name__ == '__main__':
main()