mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-19 01:34:32 +00:00
5a70dd1d82
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:]) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232184 91177308-0d34-0410-b5e6-96231b3b80d8
49 lines
2.0 KiB
LLVM
49 lines
2.0 KiB
LLVM
;; RUN: llc -mtriple=armv7-linux-gnueabi -O3 \
|
|
;; RUN: -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2 -arm-reserve-r9 \
|
|
;; RUN: -filetype=obj %s -o - | \
|
|
;; RUN: llvm-readobj -r | FileCheck -check-prefix=OBJ %s
|
|
|
|
;; FIXME: This file needs to be in .s form!
|
|
;; The args to llc are there to constrain the codegen only.
|
|
;;
|
|
;; Ensure no regression on ARM/gcc compatibility for
|
|
;; emitting explicit symbol relocs for nonexternal symbols
|
|
;; versus section symbol relocs (with offset) -
|
|
;;
|
|
;; Default llvm behavior is to emit as section symbol relocs nearly
|
|
;; everything that is not an undefined external. Unfortunately, this
|
|
;; diverges from what codesourcery ARM/gcc does!
|
|
;;
|
|
;; Tests that reloc to .L.str* show up as explicit symbols
|
|
|
|
target triple = "armv7-none-linux-gnueabi"
|
|
|
|
@.str = private constant [7 x i8] c"@null\0A\00", align 4
|
|
@.str1 = private constant [8 x i8] c"@write\0A\00", align 4
|
|
@.str2 = private constant [13 x i8] c"hello worldn\00", align 4
|
|
@.str3 = private constant [7 x i8] c"@exit\0A\00", align 4
|
|
|
|
declare i32 @mystrlen(i8* nocapture %s) nounwind readonly
|
|
|
|
declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind
|
|
|
|
define i32 @main() nounwind {
|
|
entry:
|
|
%0 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i32 6) nounwind
|
|
%1 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str1, i32 0, i32 0), i32 7) nounwind
|
|
%2 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str2, i32 0, i32 0), i32 12) nounwind
|
|
%3 = tail call i32 (...)* @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str3, i32 0, i32 0), i32 6) nounwind
|
|
tail call void @exit(i32 55) noreturn nounwind
|
|
unreachable
|
|
}
|
|
|
|
declare i32 @write(...)
|
|
|
|
declare void @exit(i32) noreturn nounwind
|
|
|
|
;; OBJ: Relocations [
|
|
;; OBJ: Section (2) .rel.text {
|
|
;; OBJ-NEXT: 0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC .L.str
|
|
;; OBJ: }
|
|
;; OBJ: ]
|