| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| ; RUN: rm -rf %t | ||
| ; RUN: mkdir %t | ||
| ; RUN: cd %t | ||
| ; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-input-lowpc-ranges-main.s \ | ||
| ; RUN: -split-dwarf-file=main.dwo -o main.o | ||
| ; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-input-lowpc-ranges-other.s \ | ||
| ; RUN: -split-dwarf-file=mainOther.dwo -o other.o | ||
| ; RUN: %clang %cflags main.o other.o -o main.exe | ||
| ; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections | ||
| ; RUN: llvm-dwarfdump --show-form --verbose --debug-rnglists main.exe.bolt &> %t/foo.txt | ||
| ; RUN: llvm-dwarfdump --show-form --verbose --debug-addr main.exe.bolt >> %t/foo.txt | ||
| ; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe.bolt >> %t/foo.txt | ||
| ; RUN: cat %t/foo.txt | FileCheck -check-prefix=BOLT %s | ||
| ; RUN: llvm-dwarfdump --show-form --verbose --debug-info main.dwo.dwo mainOther.dwo.dwo &> %t/mainddwodwo.txt | ||
| ; RUN: cat %t/mainddwodwo.txt | FileCheck -check-prefix=BOLT-DWO-MAIN %s | ||
|
|
||
| ;; Tests that BOLT correctly handles Skeleton CU which has DW_AT_low_pc/DW_AT_ranges as input and handles multiple CUs with ranges. | ||
|
|
||
| ; BOLT: Addrs: [ | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR1:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR2:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR3:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR4:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR5:]] | ||
|
|
||
| ; BOLT: Addrs: [ | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR6:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR7:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR8:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR9:]] | ||
| ; BOLT-NEXT: 0x[[#%.16x,ADDR10:]] | ||
|
|
||
| ; BOLT: DW_TAG_skeleton_unit | ||
| ; BOLT: DW_AT_dwo_name [DW_FORM_strx1] (indexed (00000001) string = "main.dwo.dwo") | ||
| ; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) | ||
| ; BOLT-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000010 | ||
| ; BOLT-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 0x16]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x16]], 0x[[#ADDR1 + 0x24]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x24]], 0x[[#ADDR1 + 0x29]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x30]], 0x[[#ADDR1 + 0x46]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x50]], 0x[[#ADDR1 + 0x77]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x77]], 0x[[#ADDR1 + 0x85]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR1 + 0x85]], 0x[[#ADDR1 + 0x9f]]) | ||
| ; BOLT-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008) | ||
| ; BOLT-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c) | ||
|
|
||
| ; BOLT: DW_TAG_skeleton_unit | ||
| ; BOLT: DW_AT_dwo_name [DW_FORM_strx1] (indexed (00000001) string = "mainOther.dwo.dwo") | ||
| ; BOLT-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) | ||
| ; BOLT-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x0000003b | ||
| ; BOLT-NEXT: [0x[[#ADDR6]], 0x[[#ADDR6 + 0x16]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x16]], 0x[[#ADDR6 + 0x24]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x24]], 0x[[#ADDR6 + 0x29]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x30]], 0x[[#ADDR6 + 0x46]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x50]], 0x[[#ADDR6 + 0x70]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x70]], 0x[[#ADDR6 + 0x7e]]) | ||
| ; BOLT-NEXT: [0x[[#ADDR6 + 0x7e]], 0x[[#ADDR6 + 0x98]]) | ||
| ; BOLT-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000038) | ||
| ; BOLT-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000037) | ||
|
|
||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000014 | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000000, 0x0000000000000016) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000016, 0x0000000000000024) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000024, 0x0000000000000029)) | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000020 | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000002, 0x0000000000000029) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000029, 0x0000000000000037) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000037, 0x0000000000000051)) | ||
|
|
||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000014 | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000000, 0x0000000000000016) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000016, 0x0000000000000024) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000024, 0x0000000000000029)) | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN: DW_TAG_subprogram | ||
| ; BOLT-DWO-MAIN-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000020 | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000002, 0x0000000000000022) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000022, 0x0000000000000030) | ||
| ; BOLT-DWO-MAIN-NEXT: [0x0000000000000030, 0x000000000000004a)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| ## If the operand references a symbol that differs from the jump table label, | ||
| ## no reference updating is required even if its target address resides within | ||
| ## the jump table's range. | ||
| ## In this test case, consider the second instruction within the main function, | ||
| ## where the address resulting from 'c + 17' corresponds to one byte beyond the | ||
| ## address of the .LJTI2_0 jump table label. However, this operand represents | ||
| ## an offset calculation related to the global variable 'c' and should remain | ||
| ## unaffected by the jump table. | ||
|
|
||
| # REQUIRES: system-linux | ||
|
|
||
| # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o | ||
| # RUN: %clang -no-pie %t.o -o %t.exe -Wl,-q | ||
| # RUN: llvm-bolt --funcs=main,foo/1 %t.exe -o %t.exe.bolt --print-normalized \ | ||
| # RUN: 2>&1 | FileCheck %s | ||
|
|
||
| .text | ||
| .globl main | ||
| .type main,@function | ||
| main: | ||
| # CHECK: Binary Function "main" | ||
| pushq %rbp | ||
| movq %rsp, %rbp | ||
| movq $-16, %rax | ||
| movl c+17(%rax), %edx | ||
| # CHECK: movl c+17(%rax), %edx | ||
| cmpl $255, %edx | ||
| je .LCorrect | ||
| movl $1, %eax | ||
| popq %rbp | ||
| ret | ||
| .LCorrect: | ||
| movl $0, %eax | ||
| popq %rbp | ||
| ret | ||
|
|
||
| .p2align 4, 0x90 | ||
| .type foo,@function | ||
| foo: | ||
| # CHECK: Binary Function "foo | ||
| movq $0, %rax | ||
| jmpq *.LJTI2_0(,%rax,8) | ||
| # CHECK: jmpq *{{.*}} # JUMPTABLE | ||
| addl $-36, %eax | ||
| .LBB2_2: | ||
| addl $-16, %eax | ||
| retq | ||
| .section .rodata,"a",@progbits | ||
| .type c,@object | ||
| .data | ||
| .globl c | ||
| .p2align 4, 0x0 | ||
| c: | ||
| .byte 1 | ||
| .byte 0xff | ||
| .zero 14 | ||
| .size c, 16 | ||
| .LJTI2_0: | ||
| .quad .LBB2_2 | ||
| .quad .LBB2_2 | ||
| .quad .LBB2_2 | ||
| .quad .LBB2_2 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //===----- SemaAVR.h ------- AVR target-specific routines -----*- C++ -*---===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// \file | ||
| /// This file declares semantic analysis functions specific to AVR. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_SEMA_SEMAAVR_H | ||
| #define LLVM_CLANG_SEMA_SEMAAVR_H | ||
|
|
||
| #include "clang/Sema/SemaBase.h" | ||
|
|
||
| namespace clang { | ||
| class Decl; | ||
| class ParsedAttr; | ||
|
|
||
| class SemaAVR : public SemaBase { | ||
| public: | ||
| SemaAVR(Sema &S); | ||
|
|
||
| void handleInterruptAttr(Decl *D, const ParsedAttr &AL); | ||
| void handleSignalAttr(Decl *D, const ParsedAttr &AL); | ||
| }; | ||
|
|
||
| } // namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_SEMA_SEMAAVR_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| //===----- SemaM68k.h ------ M68k target-specific routines ----*- C++ -*---===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// \file | ||
| /// This file declares semantic analysis functions specific to M68k. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_SEMA_SEMAM68K_H | ||
| #define LLVM_CLANG_SEMA_SEMAM68K_H | ||
|
|
||
| #include "clang/Sema/SemaBase.h" | ||
|
|
||
| namespace clang { | ||
| class Decl; | ||
| class ParsedAttr; | ||
|
|
||
| class SemaM68k : public SemaBase { | ||
| public: | ||
| SemaM68k(Sema &S); | ||
|
|
||
| void handleInterruptAttr(Decl *D, const ParsedAttr &AL); | ||
| }; | ||
| } // namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_SEMA_SEMAM68K_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| //===----- SemaMSP430.h --- MSP430 target-specific routines ---*- C++ -*---===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// \file | ||
| /// This file declares semantic analysis functions specific to MSP430. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_SEMA_SEMAMSP430_H | ||
| #define LLVM_CLANG_SEMA_SEMAMSP430_H | ||
|
|
||
| #include "clang/Sema/SemaBase.h" | ||
|
|
||
| namespace clang { | ||
| class Decl; | ||
| class ParsedAttr; | ||
|
|
||
| class SemaMSP430 : public SemaBase { | ||
| public: | ||
| SemaMSP430(Sema &S); | ||
|
|
||
| void handleInterruptAttr(Decl *D, const ParsedAttr &AL); | ||
| }; | ||
| } // namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_SEMA_SEMAMSP430_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //===----- SemaOpenCL.h --- Semantic Analysis for OpenCL constructs -------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// \file | ||
| /// This file declares semantic analysis routines for OpenCL. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_SEMA_SEMAOPENCL_H | ||
| #define LLVM_CLANG_SEMA_SEMAOPENCL_H | ||
|
|
||
| #include "clang/Sema/SemaBase.h" | ||
|
|
||
| namespace clang { | ||
| class Decl; | ||
| class ParsedAttr; | ||
|
|
||
| class SemaOpenCL : public SemaBase { | ||
| public: | ||
| SemaOpenCL(Sema &S); | ||
|
|
||
| void handleNoSVMAttr(Decl *D, const ParsedAttr &AL); | ||
| void handleAccessAttr(Decl *D, const ParsedAttr &AL); | ||
|
|
||
| // Handles intel_reqd_sub_group_size. | ||
| void handleSubGroupSize(Decl *D, const ParsedAttr &AL); | ||
| }; | ||
|
|
||
| } // namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_SEMA_SEMAOPENCL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| //===----- SemaSwift.h --- Swift language-specific routines ---*- C++ -*---===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| /// \file | ||
| /// This file declares semantic analysis functions specific to Swift. | ||
| /// | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_SEMA_SEMASWIFT_H | ||
| #define LLVM_CLANG_SEMA_SEMASWIFT_H | ||
|
|
||
| #include "clang/AST/Attr.h" | ||
| #include "clang/Basic/LLVM.h" | ||
| #include "clang/Basic/SourceLocation.h" | ||
| #include "clang/Sema/SemaBase.h" | ||
| #include "llvm/ADT/StringRef.h" | ||
|
|
||
| namespace clang { | ||
| class AttributeCommonInfo; | ||
| class Decl; | ||
| class ParsedAttr; | ||
| class SwiftNameAttr; | ||
|
|
||
| class SemaSwift : public SemaBase { | ||
| public: | ||
| SemaSwift(Sema &S); | ||
|
|
||
| SwiftNameAttr *mergeNameAttr(Decl *D, const SwiftNameAttr &SNA, | ||
| StringRef Name); | ||
|
|
||
| void handleAttrAttr(Decl *D, const ParsedAttr &AL); | ||
| void handleAsyncAttr(Decl *D, const ParsedAttr &AL); | ||
| void handleBridge(Decl *D, const ParsedAttr &AL); | ||
| void handleError(Decl *D, const ParsedAttr &AL); | ||
| void handleAsyncError(Decl *D, const ParsedAttr &AL); | ||
| void handleName(Decl *D, const ParsedAttr &AL); | ||
| void handleAsyncName(Decl *D, const ParsedAttr &AL); | ||
| void handleNewType(Decl *D, const ParsedAttr &AL); | ||
|
|
||
| /// Do a check to make sure \p Name looks like a legal argument for the | ||
| /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name | ||
| /// is invalid for the given declaration. | ||
| /// | ||
| /// \p AL is used to provide caret diagnostics in case of a malformed name. | ||
| /// | ||
| /// \returns true if the name is a valid swift name for \p D, false otherwise. | ||
| bool DiagnoseName(Decl *D, StringRef Name, SourceLocation Loc, | ||
| const ParsedAttr &AL, bool IsAsync); | ||
| void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, | ||
| ParameterABI abi); | ||
| }; | ||
|
|
||
| } // namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_SEMA_SEMASWIFT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| //===------ SemaAVR.cpp ---------- AVR target-specific routines -----------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file implements semantic analysis functions specific to AVR. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "clang/Sema/SemaAVR.h" | ||
| #include "clang/AST/DeclBase.h" | ||
| #include "clang/Basic/DiagnosticSema.h" | ||
| #include "clang/Sema/Attr.h" | ||
| #include "clang/Sema/ParsedAttr.h" | ||
| #include "clang/Sema/Sema.h" | ||
|
|
||
| namespace clang { | ||
| SemaAVR::SemaAVR(Sema &S) : SemaBase(S) {} | ||
|
|
||
| void SemaAVR::handleInterruptAttr(Decl *D, const ParsedAttr &AL) { | ||
| if (!isFuncOrMethodForAttrSubject(D)) { | ||
| Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) | ||
| << AL << AL.isRegularKeywordAttribute() << ExpectedFunction; | ||
| return; | ||
| } | ||
|
|
||
| if (!AL.checkExactlyNumArgs(SemaRef, 0)) | ||
| return; | ||
|
|
||
| handleSimpleAttribute<AVRInterruptAttr>(*this, D, AL); | ||
| } | ||
|
|
||
| void SemaAVR::handleSignalAttr(Decl *D, const ParsedAttr &AL) { | ||
| if (!isFuncOrMethodForAttrSubject(D)) { | ||
| Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) | ||
| << AL << AL.isRegularKeywordAttribute() << ExpectedFunction; | ||
| return; | ||
| } | ||
|
|
||
| if (!AL.checkExactlyNumArgs(SemaRef, 0)) | ||
| return; | ||
|
|
||
| handleSimpleAttribute<AVRSignalAttr>(*this, D, AL); | ||
| } | ||
|
|
||
| } // namespace clang |