Commit Graph

337 Commits

Author SHA1 Message Date
Lang Hames b1cd98a18d [Orc] Add support classes for inspecting and running C++ static ctor/dtors, and
use these to add support for C++ static ctors/dtors to the Orc-lazy JIT in LLI.

Replace the trivial_retval_1 regression test - the new 'hello' test is covering
strictly more code. 

llvm-svn: 233885
2015-04-02 04:34:45 +00:00
Lang Hames 1325c578c0 [Orc][MCJIT] Remove the small code model regression tests.
These regression tests are supposed to test small code model support, but have
been XFAIL'd because we don't have an in-tree memory manager that can guarantee
a small-code-model compatible memory layout. Unfortunately, they can
occasionally pass if they get lucky with memory allocation, causing unexpected
passes on the bots. That's not very helpful.

I'm going to remove these until we have the infrastructure (small-code-model
compatible memory manager) to run them properly.

llvm-svn: 233722
2015-03-31 18:19:25 +00:00
Daniel Jasper 1c012293c8 Make exit-code test use same mechanism as existing one.
The other version doesn't properly work with our internal test runner,
which sets pipefail.

llvm-svn: 233188
2015-03-25 14:35:40 +00:00
Lang Hames 9528bbaae0 [Orc][lli] Add a very simple Orc-based lazy JIT to lli.
This ensures that we're building and testing the CompileOnDemand layer, at least
in a basic way.

Currently x86-64 only, and with limited to no library calls enabled (depending
on host platform). Patches welcome. ;)

To enable access to the lazy JIT, this patch replaces the '-use-orcmcjit' lli
option with a new option:
'-jit-kind={ mcjit | orc-mcjit | orc-lazy }'.

All regression tests are updated to use the new option, and one trivial test of
the new lazy JIT is added.

llvm-svn: 233182
2015-03-25 12:11:48 +00:00
Lang Hames 1565992679 [Orc] Add missing -use-orcmcjit flag to a number of Orc regression tests.
llvm-svn: 232931
2015-03-23 06:02:49 +00:00
David Blaikie f72d05bc7b [opaque pointer type] Add textual IR support for explicit type parameter to gep operator
Similar to gep (r230786) and load (r230794) changes.

Similar migration script can be used to update test cases, which
successfully migrated all of LLVM and Polly, but about 4 test cases
needed manually changes in Clang.

(this script will read the contents of stdin and massage it into stdout
- wrap it in the 'apply.sh' script shown in previous commits + xargs to
apply it over a large set of test cases)

import fileinput
import sys
import re

rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL)

def conv(match):
  line = match.group(1)
  line += match.group(4)
  line += ", "
  line += match.group(2)
  return line

line = sys.stdin.read()
off = 0
for match in re.finditer(rep, line):
  sys.stdout.write(line[off:match.start()])
  sys.stdout.write(conv(match))
  off = match.end()
sys.stdout.write(line[off:])

llvm-svn: 232184
2015-03-13 18:20:45 +00:00
David Majnemer 1a666e0f69 ExecutionEngine: Preliminary support for dynamically loadable coff objects
Provide basic support for dynamically loadable coff objects. Only handles a subset of x64 currently.

Patch by Andy Ayers!

Differential Revision: http://reviews.llvm.org/D7793

llvm-svn: 231574
2015-03-07 20:21:27 +00:00
David Blaikie a79ac14fa6 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
Essentially the same as the GEP change in r230786.

A similar migration script can be used to update test cases, though a few more
test case improvements/changes were required this time around: (r229269-r229278)

import fileinput
import sys
import re

pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)")

for line in sys.stdin:
  sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line))

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7649

llvm-svn: 230794
2015-02-27 21:17:42 +00:00
David Blaikie 79e6c74981 [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.

This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.

* This doesn't modify gep operators, only instructions (operators will be
  handled separately)

* Textual IR changes only. Bitcode (including upgrade) and changing the
  in-memory representation will be in separate changes.

* geps of vectors are transformed as:
    getelementptr <4 x float*> %x, ...
  ->getelementptr float, <4 x float*> %x, ...
  Then, once the opaque pointer type is introduced, this will ultimately look
  like:
    getelementptr float, <4 x ptr> %x
  with the unambiguous interpretation that it is a vector of pointers to float.

* address spaces remain on the pointer, not the type:
    getelementptr float addrspace(1)* %x
  ->getelementptr float, float addrspace(1)* %x
  Then, eventually:
    getelementptr float, ptr addrspace(1) %x

Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.

update.py:
import fileinput
import sys
import re

ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile(       r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")

def conv(match, line):
  if not match:
    return line
  line = match.groups()[0]
  if len(match.groups()[5]) == 0:
    line += match.groups()[2]
  line += match.groups()[3]
  line += ", "
  line += match.groups()[1]
  line += "\n"
  return line

for line in sys.stdin:
  if line.find("getelementptr ") == line.find("getelementptr inbounds"):
    if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
      line = conv(re.match(ibrep, line), line)
  elif line.find("getelementptr ") != line.find("getelementptr ("):
    line = conv(re.match(normrep, line), line)
  sys.stdout.write(line)

apply.sh:
for name in "$@"
do
  python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
  rm -f "$name.tmp"
done

The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh

After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).

The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7636

llvm-svn: 230786
2015-02-27 19:29:02 +00:00
Zachary Turner f5f9badbbe Make frem.ll flush after calling printf.
Without this, the test was flaky, and FileCheck would sometimes
not detect any input on stdin.

llvm-svn: 229732
2015-02-18 19:32:28 +00:00
Lang Hames 35a514d200 [Orc] Make OrcMCJITReplacement::addObject calls transfer buffer ownership to the
ObjectLinkingLayer.

There are a two of overloads for addObject, one of which transfers ownership of
the underlying buffer to OrcMCJITReplacement. This commit makes the ownership
transfering version pass ownership down to the ObjectLinkingLayer in order to
prevent the issue described in r227778.

I think this commit will fix the sanitizer bot failures that necessitated the
removal of the load-object-a.ll regression test in r227785, so I'm reinstating
that test.

llvm-svn: 227845
2015-02-02 19:51:18 +00:00
Lang Hames e644b75782 [Orc] Remove one of the OrcMCJITReplacement regression tests while I
investigate a sanitizer bot failure.

llvm-svn: 227785
2015-02-02 06:01:02 +00:00
Lang Hames 16bbaf1639 [Orc] Regression tests for OrcMCJITReplacement.
Duplicated from the MCJIT regression tests.

llvm-svn: 227780
2015-02-02 05:04:55 +00:00
Lang Hames b5be1addce Remove a few more redundant ExecutionEngine regression tests.
llvm-svn: 227021
2015-01-24 22:41:13 +00:00
Lang Hames 73e55395e8 Remove a number of redundant ExecutionEngine regression tests.
These tests used to test the legacy JIT but since that has been removed they're
just redundantly testing MCJIT. Remove them and just leave their counterparts in
test/ExecutionEngine/MCJIT.

llvm-svn: 227010
2015-01-24 18:49:51 +00:00
Kuba Brecka a62bbccad0 Reverting r226937: lit: Make MCJIT's supported arch check case insensitive
The r226937 commit causes ASan lit tests to be all skipped on OS X.

llvm-svn: 226979
2015-01-24 01:42:44 +00:00
Reid Kleckner 5f5036a073 lit: Make MCJIT's supported arch check case insensitive
Should make the tests run when using CMake on systems where 'uname -p'
reports "amd64", such as FreeBSD.

Should fix PR21559.

llvm-svn: 226937
2015-01-23 21:11:40 +00:00
Lang Hames e89539f711 [MCJIT] Remove a few redundant MCJIT tests, and drop the extraneous datalayout
strings from the copies that remain.

llvm-svn: 225460
2015-01-08 18:52:15 +00:00
Alexey Samsonov 82826f7a55 XFAIL several MCJIT EH tests under ASan and MSan bootstrap.
llvm-svn: 225393
2015-01-07 21:27:26 +00:00
Joerg Sonnenberger 4af2f12153 Small model and JIT generally don't go well with each other.
On LP64 platforms, it will work or not depending on the choosen memory
layout, so neither PASS nor XFAIL is appropiate.
As UNSUPPORTED as per-test target doesn't exist (yet), remove the test
instead to unbreak the builds.

llvm-svn: 222767
2014-11-25 17:14:22 +00:00
Joerg Sonnenberger b6e36e1421 Mark as explicit failing on x86-64 -- small memory model doesn't agree
with default address selections.

llvm-svn: 222759
2014-11-25 13:28:56 +00:00
Renato Golin a03161c6ee MCJIT tests passing on ARM after r222414 fixed the relocation
llvm-svn: 222430
2014-11-20 13:32:16 +00:00
Reid Kleckner 9aeb04793a Fix symbol resolution of floating point libc builtins in MCJIT
Fix for LLI failure on Windows\X86: http://llvm.org/PR5053

LLI.exe crashes on Windows\X86 when single precession floating point
intrinsics like the following are used: acos, asin, atan, atan2, ceil,
copysign, cos, cosh, exp, floor, fmin, fmax, fmod, log, pow, sin, sinh,
sqrt, tan, tanh

The above intrinsics are defined as inline-expansions in math.h, and are
not exported by msvcr120.dll (Win32 API GetProcAddress returns null).

For an FREM instruction, the JIT compiler generates a call to a stub for
the fmodf() intrinsic, and adds a relocation to fixup at load time. The
loader searches the libraries for the function, but fails because the
symbol is not exported. So, the call target remains NULL and the
execution crashes.

Since the math functions are loaded at JIT/runtime, the JIT can patch
CALL instruction directly instead of the searching the libraries'
exported symbols.  However, this fix caused build failures due to
unresolved symbols like _fmodf at link time.

Therefore, the current fix defines helper functions in the Runtime
link/load library to perform the above operations.  The address of these
helper functions are used to patch up the CALL instruction at load time.

Reviewers: lhames, rnk

Reviewed By: rnk

Differential Revision: http://reviews.llvm.org/D5387

Patch by Swaroop Sridhar!

llvm-svn: 221947
2014-11-13 23:32:52 +00:00
Lang Hames 41d95947cf [MCJIT] Defer application of AArch64 MachO GOT relocations until resolve time.
On AArch64, GOT references are page relative (ADRP + LDR), so they can't be
applied until we know exactly where, within a page, the GOT entry will be in
the target address space.

Fixes <rdar://problem/18693976>.

llvm-svn: 220347
2014-10-21 23:41:15 +00:00
Lang Hames 2d0d096bd1 [MCJIT] Temporarily revert r220245 - it broke several bots.
(See e.g. http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/17653)

llvm-svn: 220249
2014-10-21 00:24:02 +00:00
Lang Hames 84801c217c [MCJIT] Make MCJIT honor symbol visibility settings when populating the global
symbol table.

Patch by Anthony Pesch. Thanks Anthony!

llvm-svn: 220245
2014-10-20 23:39:54 +00:00
Daniel Sanders 36a3e69bd4 [mips] Remove XFAIL from two XPASS'ing tests on the llvm-mips-linux builder
llvm-svn: 218967
2014-10-03 08:49:44 +00:00
Lang Hames 691a21ce5a [MCJIT] Make sure we test ARM BR24 relocations with both internal and external
symbols.

Previously we have only been testing these relocations with external symbols.

<rdar://problem/18308413>

llvm-svn: 217635
2014-09-11 22:43:36 +00:00
Lang Hames 6f1048f94e [MCJIT] Add support for ARM HALF_DIFF relocations to MCJIT.
Fixes <rdar://problem/18297804>.

llvm-svn: 217620
2014-09-11 19:21:14 +00:00
Lang Hames 4669cd08a7 [MCJIT] Take the relocation addend into account when applying ARM MachO VANILLA
and BR24 relocations.

<rdar://problem/18296496>

llvm-svn: 217605
2014-09-11 17:27:01 +00:00
Lang Hames eb195f0151 [MCJIT] Make sure eh-frame fixups use the target's pointer type, not the host's.
If the wrong pointer type is used it can cause corruption of the frame
description entries.

llvm-svn: 217124
2014-09-04 04:53:03 +00:00
Eric Christopher 79cc1e3ae7 Reinstate "Nuke the old JIT."
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reinstates commits r215111, 215115, 215116, 215117, 215136.

llvm-svn: 216982
2014-09-02 22:28:02 +00:00
Josh Klontz e1900dc920 [PATCH][Interpreter] Add missing FP intrinsic lowering.
Summary:
This extends the work done in [1], adding missing intrinsic lowering for floor, trunc, round and copysign.

[1] http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/199372

Test Plan: Extended `test/ExecutionEngine/Interpreter/intrinsics.ll` to test the additional missing intrinsics. All tests pass.

Reviewers: dexonsmith

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5120

llvm-svn: 216827
2014-08-30 18:33:35 +00:00
Lang Hames df7be5105a [MCJIT] Add an i386 RuntimeDyldMachO test case.
llvm-svn: 216024
2014-08-19 21:26:36 +00:00
Josh Klontz ac0d28dfe6 Add missing Interpreter intrinsic lowering for sin, cos and ceil
llvm-svn: 215209
2014-08-08 15:00:12 +00:00
Eric Christopher b9fd9ed37e Temporarily Revert "Nuke the old JIT." as it's not quite ready to
be deleted. This will be reapplied as soon as possible and before
the 3.6 branch date at any rate.

Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reverts commits r215111, 215115, 215116, 215117, 215136.

llvm-svn: 215154
2014-08-07 22:02:54 +00:00
Rafael Espindola e20470d399 Remove a few XFAILs.
These tests now pass with MCJIT.

llvm-svn: 215136
2014-08-07 19:35:22 +00:00
Rafael Espindola f8b27c41e8 Nuke the old JIT.
I am sure we will be finding bits and pieces of dead code for years to
come, but this is a good start.

Thanks to Lang Hames for making MCJIT a good replacement!

llvm-svn: 215111
2014-08-07 14:21:18 +00:00
Lang Hames 1316365e2c [MCJIT] Fix the ARM BR24 relocation in RuntimeDyldMachO.
We now (1) correctly decode the branch immediate, (2) modify the immediate to
corretly treat it as PC-rel, and (3) properly populate the stub entry.
Previously we had been doing each of these wrong.

<rdar://problem/17750739>

llvm-svn: 214285
2014-07-30 03:35:05 +00:00
Lang Hames 3ce5baefce [MCJIT] XFAIL some RuntimeDyld tests on MIPS - RuntimeDyldChecker isn't properly
endian-aware yet, and this is causing failures when cross-linking on MIPS.

llvm-svn: 214231
2014-07-29 21:48:22 +00:00
Lang Hames 480763f814 [MCJIT] Make the RuntimeDyldChecker stub_addr builtin use file names rather than
full paths for its first argument.

This allows us to remove the annoying sed lines in the test cases, and write
direct references to file names in stub_addr calls (rather than <filename>
placeholders).

llvm-svn: 214211
2014-07-29 20:40:37 +00:00
Juergen Ributzka 0e913b17d6 [RuntimeDyld][AArch64] Make encode/decodeAddend also work on big-endian hosts.
llvm-svn: 214205
2014-07-29 19:57:15 +00:00
Lang Hames 1f638440c6 [MCJIT] Remove extraneous parentheses in test case.
llvm-svn: 214117
2014-07-28 21:00:48 +00:00
Juergen Ributzka fa154f03d1 [RuntimeDyld][AArch64] Update relocation tests and also add a simple GOT test.
llvm-svn: 213807
2014-07-23 22:23:17 +00:00
NAKAMURA Takumi 0a6af4391b Rework to let RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s pass on win32.
FIXME: "llvm-rtdyld -verify -check" is still sensitive to path separator.
Fix searching StubMap to be tolerant of both '/' and '\\' on Win32.

llvm-svn: 213723
2014-07-23 04:32:21 +00:00
NAKAMURA Takumi 24c0b46e18 Suppress a test on win32 for now, llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s.
FIXME: Fix searching StubMap with '/' and '\\' on Win32.
llvm-svn: 213721
2014-07-23 04:05:58 +00:00
NAKAMURA Takumi 7d79387981 RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s: Use %/T here, or sed(1) would be confused with dos path.
llvm-svn: 213720
2014-07-23 04:05:46 +00:00
Juergen Ributzka 7325ac39b6 XFAIL the test on MIPS
Not sure how to debug this one without a MIPS machine. Any takers?

llvm-svn: 213705
2014-07-22 23:15:01 +00:00
Lang Hames f7acddde5b [MCJIT] Refactor and add stub inspection to the RuntimeDyldChecker framework.
This patch introduces a 'stub_addr' builtin that can be used to find the address
of the stub for a given (<file>, <section>, <symbol>) tuple. This address can be
used both to verify the contents of stubs (by loading from the returned address)
and to verify references to stubs (by comparing against the returned address).

Example (1) - Verifying stub contents:

Load 8 bytes (assuming a 64-bit target) from the stub for 'x' in the __text
section of f.o, and compare that value against the addres of 'x'.

# rtdyld-check: *{8}(stub_addr(f.o, __text, x) = x

Example (2) - Verifying references to stubs:

Decode the immediate of the instruction at label 'l', and verify that it's
equal to the offset from the next instruction's PC to the stub for 'y' in the
__text section of f.o (i.e. it's the correct PC-rel difference).

# rtdyld-check: decode_operand(l, 4) = stub_addr(f.o, __text, y) - next_pc(l)
l:
        movq    y@GOTPCREL(%rip), %rax

Since stub inspection requires cooperation with RuntimeDyldImpl this patch
pimpl-ifies RuntimeDyldChecker. Its implementation is moved in to a new class,
RuntimeDyldCheckerImpl, that has access to the definition of RuntimeDyldImpl.

llvm-svn: 213698
2014-07-22 22:47:39 +00:00
Juergen Ributzka f560928889 [RuntimeDyld][MachO][AArch64] Add a helper function for encoding addends in instructions.
Factor out the addend encoding into a helper function and simplify the
processRelocationRef.

Also add a few simple rtdyld tests. More tests to come once GOTs can be tested too.

Related to <rdar://problem/17768539>

llvm-svn: 213689
2014-07-22 21:42:55 +00:00
Lang Hames 87c025bb17 [RuntimeDyld] Replace a crufty old ARM RuntimeDyld test with a new one that uses
RuntimeDyldChecker.

This allows us to remove one of the six remaining object files in the LLVM
source tree.

llvm-svn: 212780
2014-07-10 23:29:11 +00:00
Chandler Carruth d5821f36d9 Fix this test to not write to the source tree, and instead to write to
a temporary file. This fixes the test in cases where the source tree is
mounted read-only.

llvm-svn: 211975
2014-06-28 05:18:49 +00:00
Lang Hames 116d1354b6 [RuntimeDyld] Make sure that RuntimeDyld regression tests only run for targets
that have been enabled.

Without this, testers will fail when llvm-rtdyld is invoked with triples for
unsupported targets.

llvm-svn: 211969
2014-06-27 23:29:18 +00:00
Lang Hames e1c1138a38 [RuntimeDyld] Add a framework for testing relocation logic in RuntimeDyld.
This patch adds a "-verify" mode to the llvm-rtdyld utility. In verify mode,
llvm-rtdyld will test supplied expressions against the linked program images
that it creates in memory. This scheme can be used to verify the correctness
of the relocation logic applied by RuntimeDyld.

The expressions to test will be read out of files passed via the -check option
(there may be more than one of these). Expressions to check are extracted from
lines of the form:
# rtdyld-check: <expression>

This system is designed to fit the llvm-lit regression test workflow. It is
format and target agnostic, and supports verification of images linked for
remote targets. The expression language is defined in
llvm/include/llvm/RuntimeDyldChecker.h . Examples can be found in
test/ExecutionEngine/RuntimeDyld.

llvm-svn: 211956
2014-06-27 20:20:57 +00:00
Ulrich Weigand dbc8e1ae28 [RuntimeDyld] Support more PPC64 relocations
This adds support for several missing PPC64 relocations in the
straight-forward manner to RuntimeDyldELF.cpp.

Note that this actually fixes a failure of a large-model test case on
PowerPC, allowing the XFAIL to be removed.

llvm-svn: 211382
2014-06-20 17:51:47 +00:00
Will Schmidt 12090677de mark the old jit tests as unsupported for powerpc64 (for cmake)
mark the old JIT tests as unsupported for powerpc64 - CMake style.
This follows the style used for hexagon/arm64/aarch64.
The equivalent tests still run under the supported MCJIT/*

llvm-svn: 211111
2014-06-17 17:04:42 +00:00
Alp Toker d3d017cf00 Reduce verbiage of lit.local.cfg files
We can just split targets_to_build in one place and make it immutable.

llvm-svn: 210496
2014-06-09 22:42:55 +00:00
Alexey Samsonov ad81f0f419 Use AArch64 instead of now removed ARM64 in test configs
llvm-svn: 210229
2014-06-05 00:25:30 +00:00
Lang Hames 9f7d14756d Fix testers by removing dubious testcase for r209154.
It turns out that not all the world is x86-64. Who knew?

I'll get to work on a more appropriate test case for this patch.

llvm-svn: 209155
2014-05-19 19:38:48 +00:00
Lang Hames 1fcbc08500 [RuntimeDyld] Fix x86-64 MachO GOT relocation handling.
For GOT relocations the addend should modify the offset to the
GOT entry, not the value of the entry itself. Teach RuntimeDyldMachO
to do The Right Thing here.

Fixes <rdar://problem/16961886>.
 

llvm-svn: 209154
2014-05-19 19:21:25 +00:00
Tilmann Scheller 4418dda5ef [ARM64] Disable regression tests for the old JIT.
Since the ARM64 backend doesn't implement support for the old JIT those tests are failing when the regression tests are run on an AArch64 host.

llvm-svn: 207530
2014-04-29 15:02:40 +00:00
Renato Golin 69736692d8 Ignore old JIT tests in AARch64 - CMake style
llvm-svn: 202126
2014-02-25 09:31:00 +00:00
Renato Golin c2ae1b1b41 PC-rel implemented in AArch64, test now pass
llvm-svn: 201243
2014-02-12 17:17:41 +00:00
Petar Jovanovic f387387835 mips: XFAIL non-extern-addend-smallcodemodel test
Small code model (and default reloc model) set Reloc::PIC_ in this test,
and PIC is not yet supported in MCJIT for MIPS.

llvm-svn: 200852
2014-02-05 16:47:59 +00:00
Lang Hames b0bd489e4a Split out small-code-model MCJIT testcase in order to xfail for AArch64, where
PC-rel relocations aren't yet fully implemented.

llvm-svn: 200592
2014-01-31 23:36:25 +00:00
Lang Hames 2cbbdf41c0 Add support for PC-relative non-extern relocations to RuntimeDyldMachO.
Also replaces testcase for r180790 (support for absolute non-externs relocs)
with a more robust version.

<rdar://problem/15864721>

llvm-svn: 200404
2014-01-29 18:31:35 +00:00
Renato Golin 8cea6e8fc6 Enable EHABI by default
After all hard work to implement the EHABI and with the test-suite
passing, it's time to turn it on by default and allow users to
disable it as a work-around while we fix the eventual bugs that show
up.

This commit also remove the -arm-enable-ehabi-descriptors, since we
want the tables to be printed every time the EHABI is turned on
for non-Darwin ARM targets.

Although MCJIT EHABI is not working yet (needs linking with the right
libraries), this commit also fixes some relocations on MCJIT regarding
the EH tables/lib calls, and update some tests to avoid using EH tables
when none are needed.

The EH tests in the test-suite that were previously disabled on ARM
now pass with these changes, so a follow-up commit on the test-suite
will re-enable them.

llvm-svn: 200388
2014-01-29 11:50:56 +00:00
Renato Golin 1df7b30745 Re-enabling MCJIT tests on ARM
After several refactorings on the MCJIT remote communication, things are
finally looking good on Clang-compiled LLVM regarding MCJIT remote tests,
so I'm re-enabling them to see how the self-hosting buildbot behaves over
a longer period.

llvm-svn: 200102
2014-01-25 23:38:08 +00:00
Alp Toker a11863820c Eliminate inappropriate use of FindProgramByName() from lli
llvm-svn: 199835
2014-01-22 21:52:35 +00:00
Renato Golin da3b5987ca Revert 199262 - MCJIT remote still failing on ARM
Disabling remote MCJIT tests on ARM again, as they're still failing when
self-hosting on ARM, despite all my tests. At least now we have more info
on what message it's breaking and what is going on. Investigating.

llvm-svn: 199310
2014-01-15 09:09:46 +00:00
Renato Golin f7eddfeab5 Re-disable MCJIT remote tests on ARM
llvm-svn: 199309
2014-01-15 09:09:39 +00:00
Renato Golin 4086bf7156 Re-enable remote MCJIT tests on ARMv7
llvm-svn: 199262
2014-01-14 22:43:49 +00:00
NAKAMURA Takumi eccd28d519 llvm/test/ExecutionEngine/MCJIT/load-object-a.ll: Put together rm(1) and mkdir(1) at the top.
llvm-svn: 199077
2014-01-13 05:55:10 +00:00
NAKAMURA Takumi d38ac74662 llvm/test/ExecutionEngine/MCJIT/load-object-a.ll: Remove "REQUIRES:shell". This doesn't depend on shell's behavior.
llvm-svn: 198931
2014-01-10 10:38:52 +00:00
NAKAMURA Takumi 566080cc80 llvm/test/ExecutionEngine/MCJIT/lit.local.cfg: Add "AMD64" in the host_arch list.
FIXME: We should not take CMake's ${CMAKE_SYSTEM_PROCESSOR}...
llvm-svn: 198930
2014-01-10 10:38:46 +00:00
NAKAMURA Takumi 52f9d3818b llvm/test/ExecutionEngine/MCJIT/load-object-a.ll: Fix not to use %t.cachedir/%p.
%p is like X:\foo\bar.

llvm-svn: 198926
2014-01-10 10:38:23 +00:00
Lang Hames 1ddecc0777 Add an "-object-cache-dir=<string>" option to LLI. This option specifies the
root path to which object files managed by the LLIObjectCache instance should be
written. This option defaults to "", in which case objects are cached in the
same directory as the bitcode they are derived from.

The load-object-a.ll test has been rewritten to use this option to support
testing in environments where the test directory is not writable.

llvm-svn: 198852
2014-01-09 05:24:05 +00:00
Lang Hames 7b6f99ff0d Add missing test case for r198737.
llvm-svn: 198772
2014-01-08 16:31:16 +00:00
NAKAMURA Takumi db47bcc63d Remove empty MCJIT/load-object-a.ll since r196641.
llvm-svn: 196645
2013-12-07 06:17:10 +00:00
Lang Hames 567befd88f Revert r196639 while I investigate a bot failure.
llvm-svn: 196641
2013-12-07 04:25:19 +00:00
Lang Hames a691358078 Add support for archives and object file caching under MCJIT.
Patch by Andy Kaylor, with minor edits to resolve merge conflicts.

llvm-svn: 196639
2013-12-07 03:05:51 +00:00
Renato Golin 2b22f6ae96 Fix lit config for disabled MCJIT tests on ARM
Separating permanent from temporary targets, added the bug that
will fix the temporary (PR18057).

llvm-svn: 196274
2013-12-03 13:48:28 +00:00
Renato Golin 4281a1399a Disable Remote MCJIT tests on ARM
The communication protocol is unstable on ARM when compiled
with Clang, which is disrupting the self-hosting buildbots that
are going to be added this week. I'm working on a solution, but
remote MCJIT is not high-priority for ARM at the moment, so it
might take a while.

llvm-svn: 196257
2013-12-03 08:39:15 +00:00
Petar Jovanovic 45115f877c [mips] Resolve relocation for the stubs in MCJIT when load address is known
Instead of processing relocation for branch to stubs right away, emit a
modified relocation and add it to queue to be resolved later when final load
address is known.
This resolves seven MIPS MCJIT issues that were caused by missing relocation
fixups at the end.

llvm-svn: 195157
2013-11-19 21:56:00 +00:00
NAKAMURA Takumi db5d18d245 Add XFAIL:arm again on 4 MCJIT tests, since r194558. AArch64 has been left removed.
They are failing on clang-native-arm-cortex-a9.

Please tweak MCJIT/lit.local.cfg, if this didn't satisfy bots.

llvm-svn: 194561
2013-11-13 07:43:10 +00:00
NAKAMURA Takumi b71b7baa2f Remove XFAIL:aarch64,arm from 4 tests in test/ExecutionEngine/MCJIT.
They are reported as XPASSing.

llvm-svn: 194558
2013-11-13 06:28:00 +00:00
Petar Jovanovic 1f8578dca6 [mips] XFAIL several MCJIT remote tests
Two of the tests are new test cases (cross-module-a.ll, multi-module-a.ll)
not yet supported on MIPS, while XFAIL for the other two tests was
accidentally removed in r193570 and this change reverts those lines.

llvm-svn: 193781
2013-10-31 18:10:25 +00:00
Andrew Kaylor 1ca510ea67 Adding a workaround for __main linking with remote lli and Cygwin/MinGW
llvm-svn: 193570
2013-10-29 01:29:56 +00:00
Andrew Kaylor 2873b38e69 Renaming MCJIT .ir files to .ll and moving them to Inputs
llvm-svn: 193562
2013-10-28 23:51:03 +00:00
Andrew Kaylor 4404eb4857 Standardizing lli's extra module command line option
llvm-svn: 193544
2013-10-28 21:58:15 +00:00
NAKAMURA Takumi 5bb014371e MCJIT-remote: __main should be resolved in child context.
- Mark tests as XFAIL:cygming in test/ExecutionEngine/MCJIT/remote.
    Rather to suppress them, I'd like to leave them running as XFAIL.
  - Revert r193472. RecordMemoryManager no longer resolves __main on cygming.

There are a couple of issues.

  - X86 Codegen emits "call __main" in @main for targeting cygming.
    It is useless in JIT. FYI, tests are passing when emitting __main is disabled.
  - Current remote JIT does not resolve any symbols in child context.

FIXME: __main should be disabled, or remote JIT should resolve __main.
llvm-svn: 193498
2013-10-27 10:22:52 +00:00
Nick Lewycky f8c68da7a9 Fix typo in test's XFAIL line. Patch by Dimitry Andric!
llvm-svn: 193063
2013-10-21 00:46:21 +00:00
Andrew Kaylor 6587bcfdbc Fixing problems in lli's RemoteMemoryManager.
This fixes a problem from a previous check-in where a return value was omitted.

Previously the remote/stubs-remote.ll and remote/stubs-sm-pic.ll tests were reporting passes, but they should have been failing.  Those tests attempt to link against an external symbol and remote symbol resolution is not supported.  The old RemoteMemoryManager implementation resulted in local symbols being used for resolution and the child process crashed but the test didn't notice.  With this check-in remote symbol resolution fails, and so the test (correctly) fails.

llvm-svn: 192514
2013-10-11 22:47:10 +00:00
Andrew Kaylor 7bb1344c67 Adding multiple object support to MCJIT EH frame handling
llvm-svn: 192504
2013-10-11 21:25:48 +00:00
Andrew Kaylor b2c1ee2a96 Updating XFAILs for recent GOT tests
llvm-svn: 192022
2013-10-05 01:56:50 +00:00
Andrew Kaylor 4968ca50e8 Adding tests for multiple GOTs with MCJIT
llvm-svn: 192021
2013-10-05 01:53:19 +00:00
Andrew Kaylor 1b2cfb6495 Adding support and tests for multiple module handling in lli
llvm-svn: 191938
2013-10-04 00:49:38 +00:00
Andrew Kaylor c2ebf3f517 Adding out-of-process execution support to lli.
At this time only Unix-based systems are supported.  Windows has stubs and should re-route to the simulated mode.

Thanks to Sriram Murali for contributions to this patch.

llvm-svn: 191843
2013-10-02 17:12:36 +00:00
Andrew Kaylor ec2ea125a8 Fix some more MCJIT PIC test XFAILs (for i386)
Patch by Dimitry Andric

llvm-svn: 191111
2013-09-20 22:12:03 +00:00
Amaury de la Vieuville 9fd5e53f1d Add "native" to config.available_features, to make it easier to disable non-x-compile-safe tests
Patch by Artyom Skrobov!

llvm-svn: 190679
2013-09-13 10:59:01 +00:00
Elena Demikhovsky c2293fc7f2 LLVM interpreter: added a test for insert- extract- value
llvm-svn: 190600
2013-09-12 10:52:03 +00:00
Elena Demikhovsky 843657c311 llvm interpreter: select, shuffle and insertelement instructions.
This patch implements vector support for  select instruction and adds specific vector instructions : shuffle and insertelement. (tests are also included)
and functions lle_X_memset, lle_X_memcpy added.

Done by Veselov, Yuri (mailto:Yuri.Veselov@intel.com)

llvm-svn: 189735
2013-09-02 06:40:09 +00:00
Nadav Rotem 7efc04cb40 In LLVM FMA3 operands are dst, src1, src2, src3, however dst is not encoded as it is always src1. This was causing the encoding of the operands to be off by one.
Patch by Chris Bieneman.

llvm-svn: 188866
2013-08-21 05:03:10 +00:00
NAKAMURA Takumi de8880a23d X86TargetMachine.cpp: Clarify to emit GOT in i686-{cygming|win32}-elf for mcjit.
I suppose all "lli -use-mcjit i686-*" should require GOT, (and to fail.)

llvm-svn: 188856
2013-08-21 02:37:25 +00:00
Andrew Kaylor 00b8fe583d Still more MCJIT PIC test XFAILs
llvm-svn: 188815
2013-08-20 18:13:48 +00:00
Andrew Kaylor c20ace87fa Clarifying two MCJIT PIC tests as XFAIL on i686-pc-linux
llvm-svn: 188814
2013-08-20 17:01:35 +00:00
Andrew Kaylor fae66f2aa8 Removing duplicate XFAIL markers
llvm-svn: 188812
2013-08-20 16:42:22 +00:00
Andrew Kaylor cf90777cd0 Marking two more MCJIT PIC tests as XFAIL on i686
llvm-svn: 188808
2013-08-20 15:47:04 +00:00
Andrew Kaylor e35613b962 Marking MCJIT PIC tests as XFAIL on arm
llvm-svn: 188807
2013-08-20 15:36:04 +00:00
Andrew Kaylor e0c8f50f3e Marking MCJIT PIC tests as XFAIL on AArch64
llvm-svn: 188740
2013-08-20 01:50:50 +00:00
Andrew Kaylor ef7280c7f4 Fixing XPASSes among MCJIT PIC test on i686
llvm-svn: 188736
2013-08-20 00:37:33 +00:00
Andrew Kaylor 99974313d5 Second attempt to mark Large/PIC MCJIT test as XFAIL for PowerPC64
llvm-svn: 188735
2013-08-20 00:22:03 +00:00
Andrew Kaylor 2393389226 Marking two MCJIT PIC tests as XFAIL on Darwin
llvm-svn: 188734
2013-08-20 00:14:50 +00:00
Andrew Kaylor c4c1ff6ddd Trying again with PIC tests for MCJIT
llvm-svn: 188730
2013-08-19 23:52:53 +00:00
Andrew Kaylor 28c2370602 Reverting r188709 until I can figure out the proper way to XFAIL it.
llvm-svn: 188715
2013-08-19 22:05:07 +00:00
Andrew Kaylor 93bf08705a Adding tests for PIC with MCJIT
llvm-svn: 188709
2013-08-19 21:08:35 +00:00
Daniel Dunbar 9efbedfd35 [tests] Cleanup initialization of test suffixes.
- Instead of setting the suffixes in a bunch of places, just set one master
   list in the top-level config. We now only modify the suffix list in a few
   suites that have one particular unique suffix (.ml, .mc, .yaml, .td, .py).

 - Aside from removing the need for a bunch of lit.local.cfg files, this enables
   4 tests that were inadvertently being skipped (one in
   Transforms/BranchFolding, a .s file each in DebugInfo/AArch64 and
   CodeGen/PowerPC, and one in CodeGen/SI which is now failing and has been
   XFAILED).

 - This commit also fixes a bunch of config files to use config.root instead of
   older copy-pasted code.

llvm-svn: 188513
2013-08-16 00:37:11 +00:00
Lang Hames fe2833be4d Optimistically ignore scattered relocations in MachO in RuntimeDyld. This
un-breaks simple use cases while I work on more general support.

<rdar://problem/14487667>

llvm-svn: 188044
2013-08-09 00:57:01 +00:00
Elena Demikhovsky cfd982af80 LLVM Interpreter: MIPS tests should pass
llvm-svn: 187867
2013-08-07 06:13:21 +00:00
Elena Demikhovsky 63bd63e4a3 LLVM Interpreter: fixed bug 16694
fix for: Bug 16694 - ExecutionEngine/test-interp-vec-loadstore.ll failing on powerpc-darwin8 (http://llvm.org/bugs/show_bug.cgi?id=16694)
The ExecutionEngine/test-interp-vec-loadstore.ll test has been failing on powerpc-darwin8 (on other platforms it passed)

the reason of fail was wrong output by printf. this output is checked by FileCheck, but on little-endian powerpc the output numeric data were printed inside out and FileCheck reported fail.
the printfs have been replaced by checking data inside test and numeric output has been replaced by the text output like : "int test passed, float test passed". The text output is checked by FileCheck.
the dependency on data layout has been removed.

done by Yuri Veselov (Intel)

llvm-svn: 187791
2013-08-06 10:40:45 +00:00
Elena Demikhovsky 62d19c8bdf LLVM Interpreter: This patch implements vector support for cast operations (zext, sext, uitofp, sitofp, trunc, fpext, fptosi, fptrunc, bitcast) and shift operations (shl, ashr, lshr) for integer and floating point data types.
Added tests.

Done by Yuri Veselov (mailto:Yuri.Veselov@intel.com).

llvm-svn: 187724
2013-08-05 12:17:06 +00:00
Petar Jovanovic 514d37ab4c [mips] Remove XFAIL from test-ptr-reloc-remote.ll
The change r187019 has fixed multiple relocations in dynamic linker for
MIPS, so now this test passes for MIPS.

llvm-svn: 187053
2013-07-24 17:14:05 +00:00
Stephen Lin 6dd347b39f Add newlines at end of test files, no functionality change
llvm-svn: 186263
2013-07-13 22:00:58 +00:00
Rafael Espindola f102438f3a Enable mcjit tests on ppc64 when building with cmake.
llvm-svn: 183143
2013-06-03 19:17:21 +00:00
Tim Northover c35854077b Disable new legacy JIT test on ARM.
llvm-svn: 183071
2013-06-01 10:24:11 +00:00
Tim Northover 3a1fd4c0ac X86: change MOV64ri64i32 into MOV32ri64
The MOV64ri64i32 instruction required hacky MCInst lowering because it
was allocated as setting a GR64, but the eventual instruction ("movl")
only set a GR32. This converts it into a so-called "MOV32ri64" which
still accepts a (appropriate) 64-bit immediate but defines a GR32.
This is then converted to the full GR64 by a SUBREG_TO_REG operation,
thus keeping everyone happy.

This fixes a typo in the opcode field of the original patch, which
should make the legact JIT work again (& adds test for that problem).

llvm-svn: 183068
2013-06-01 09:55:14 +00:00
Tim Northover 3b684d8359 ARM: use pristine object file while processing relocations
Previously we would read-modify-write the target bits when processing
relocations for the MCJIT. This had the problem that when relocations
were processed multiple times for the same object file (as they can
be), the result is not idempotent and the values became corrupted.

The solution to this is to take any bits used in the destination from
the pristine object file as LLVM emitted it.

This should fix PR16013 and remote MCJIT on ARM ELF targets.

llvm-svn: 182800
2013-05-28 19:48:19 +00:00
Renato Golin 9e18922d67 Disable remote MCJIT on pre-v6 ARM
llvm-svn: 182235
2013-05-20 07:46:06 +00:00
Tim Northover 77d0a4ac62 Invalidate instruction cache when setting memory to be executable.
lli's remote MCJIT code calls setExecutable just prior to running
code. In line with Darwin behaviour this seems to be the place to
invalidate any caches needed so that relocations can take effect
properly.

llvm-svn: 182213
2013-05-19 15:28:16 +00:00
Renato Golin d684165620 Unsupported remote JIT on ARM
llvm-svn: 182201
2013-05-18 19:42:07 +00:00
Rafael Espindola 65c016b106 XFAIL this test for mingw too.
llvm-svn: 181678
2013-05-13 00:18:24 +00:00
Aaron Ballman e42ccf32cc XFAILing this test on Win32 to unbreak the build bots.
llvm-svn: 181600
2013-05-10 14:42:16 +00:00
Adhemerval Zanella e8bd03da5c PowerPC: Fix unimplemented relocation on ppc64
This patch handles the R_PPC64_REL64 relocation type for powerpc64
for mcjit.

llvm-svn: 181220
2013-05-06 17:21:23 +00:00
Ulrich Weigand 80435baa14 [SystemZ] Set up JIT/MCJIT test cases
This patch adds the necessary configuration bits and #ifdef's to set up
the JIT/MCJIT test cases for SystemZ.  Like other recent targets, we do
fully support MCJIT, but do not support the old JIT at all.  Set up the
lit config files accordingly, and disable old-JIT unit tests.

Patch by Richard Sandiford.

llvm-svn: 181207
2013-05-06 16:21:50 +00:00
Rafael Espindola 57dc142d40 Free the exception object. Should fix the vg bots.
llvm-svn: 181195
2013-05-06 13:30:52 +00:00
Rafael Espindola 072f4d9a1e XFAIL for cygwin.
Looks like symbol resolution is not working on cygwin, the test fails
because __gxx_personality_v0 is not found.

llvm-svn: 181179
2013-05-06 03:35:56 +00:00
Rafael Espindola f48af0ae1d This should also fail on ARM.
We currently have no way to register new eh frames on ARM.

llvm-svn: 181172
2013-05-05 22:42:34 +00:00
Rafael Espindola b32c880b31 Fix XFAIL line.
llvm-svn: 181171
2013-05-05 21:30:10 +00:00
Rafael Espindola e639744c4b XFAIL this on ppc64.
It looks like eh uses an unimplemented relocation on pp64

llvm-svn: 181169
2013-05-05 21:04:18 +00:00
Rafael Espindola fa5942bc2c Add EH support to the MCJIT.
This gets exception handling working on ELF and Macho (x86-64 at least).
Other than the EH frame registration, this patch also implements support
for GOT relocations which are used to locate the personality function on
MachO.

llvm-svn: 181167
2013-05-05 20:43:10 +00:00
Tim Northover 7b55b97dba AArch64: enable MCJIT and tests now that everything passes.
This removes dire warnings about AArch64 being unsupported and enables
the tests when appropriate on this platform.

llvm-svn: 181135
2013-05-04 20:14:22 +00:00
Rafael Espindola 52501033d0 Fix Addend computation for non external relocations on Macho.
llvm-svn: 180790
2013-04-30 15:40:54 +00:00
Rafael Espindola d00c2765aa Collect the Addend for external relocs.
This fixes 2013-04-04-RelocAddend.ll. We don't have a testcase for non external
relocs with an Addend. I will try to write one.

llvm-svn: 180767
2013-04-30 01:29:57 +00:00
Rafael Espindola e4dd2e0132 Add getSymbolAlignment to the ObjectFile interface.
For regular object files this is only meaningful for common symbols. An object
file format with direct support for atoms should be able to provide alignment
information for all symbols.

This replaces getCommonSymbolAlignment and fixes
test-common-symbols-alignment.ll on darwin. This also includes a fix to
MachOObjectFile::getSymbolFlags. It was marking undefined symbols as common
(already tested by existing mcjit tests now that it is used).

llvm-svn: 180736
2013-04-29 22:24:22 +00:00
Rafael Espindola 29cb481ba0 Disable the MCJIT tests on 32 bit darwin.
I recently enabled them on 32 and 64 bit darwin, but it looks like 32 bit is
still fairly broken.

llvm-svn: 180730
2013-04-29 21:09:32 +00:00
Rafael Espindola f1f1c626e7 Propagate relocation info to resolveRelocation.
This gets most of the MCJITs tests passing with MachO.

llvm-svn: 180716
2013-04-29 17:24:34 +00:00
Nadav Rotem be0e89d9e8 Teach the interpreter to handle vector compares and additional vector arithmetic operations.
Patch by Yuri Veselov.

llvm-svn: 180626
2013-04-26 20:19:41 +00:00
Nadav Rotem 4e4d45e507 Revert r179409 because it caused some warnings and some of the build bots fail.
llvm-svn: 179418
2013-04-12 22:02:26 +00:00
Nadav Rotem e4b8aa001c Add support for additional vector instructions in the interpreter.
patch by Veselov, Yuri <Yuri.Veselov@intel.com>.

llvm-svn: 179409
2013-04-12 20:45:20 +00:00
Eli Bendersky ed61b06fa8 Rewrite test/ExecutionEngine tests to use FileCheck instead of grep
llvm-svn: 179043
2013-04-08 19:51:36 +00:00