Prune CRLF.

llvm-svn: 220678
This commit is contained in:
NAKAMURA Takumi 2014-10-27 12:37:26 +00:00
parent 64df1f177b
commit 729be14435
22 changed files with 716 additions and 716 deletions

View File

@ -6,96 +6,96 @@ int i = MACRO;
#endif
#undef MACRO
#if defined(MACRO)
#endif
#define FUNCMACRO(ARG1) ARG1
#endif
#define FUNCMACRO(ARG1) ARG1
int j = FUNCMACRO(1);
#define X X_IMPL(a+y,b) X_IMPL2(c)
#define X_IMPL(p1,p2)
#define X_IMPL2(p1)
X
// CHECK: ---
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_HOSTED__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __cplusplus
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_UTF_16__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_UTF_32__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9"]
// CHECK-NEXT: Args: (null)
// CHECK-NEXT: - Callback: Defined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2"
// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:1"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:2"
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2"
// CHECK-NEXT: - Callback: MacroUndefined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: Defined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: (null)
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2"
// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:1"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2"
// CHECK-NEXT: - Callback: SourceRangeSkipped
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"]
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: FUNCMACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: FUNCMACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:20"]
// CHECK-NEXT: Args: [1]
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X_IMPL
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X_IMPL2
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1"]
// CHECK-NEXT: Args: (null)
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X_IMPL
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: [(nonfile), (nonfile)]
// CHECK-NEXT: Args: [a <plus> y, b]
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X_IMPL2
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: [(nonfile), (nonfile)]
// CHECK-NEXT: Args: [c]
// CHECK-NEXT: - Callback: EndOfMainFile
// CHECK-NEXT: ...
#define X X_IMPL(a+y,b) X_IMPL2(c)
#define X_IMPL(p1,p2)
#define X_IMPL2(p1)
X
// CHECK: ---
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_HOSTED__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __cplusplus
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_UTF_16__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: __STDC_UTF_32__
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9"]
// CHECK-NEXT: Args: (null)
// CHECK-NEXT: - Callback: Defined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2"
// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:1"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:2"
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2"
// CHECK-NEXT: - Callback: MacroUndefined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: Defined
// CHECK-NEXT: MacroNameTok: MACRO
// CHECK-NEXT: MacroDirective: (null)
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2"
// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:1"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2"
// CHECK-NEXT: - Callback: SourceRangeSkipped
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"]
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: FUNCMACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: FUNCMACRO
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:20"]
// CHECK-NEXT: Args: [1]
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X_IMPL
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroDefined
// CHECK-NEXT: MacroNameTok: X_IMPL2
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1"]
// CHECK-NEXT: Args: (null)
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X_IMPL
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: [(nonfile), (nonfile)]
// CHECK-NEXT: Args: [a <plus> y, b]
// CHECK-NEXT: - Callback: MacroExpands
// CHECK-NEXT: MacroNameTok: X_IMPL2
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK-NEXT: Range: [(nonfile), (nonfile)]
// CHECK-NEXT: Args: [c]
// CHECK-NEXT: - Callback: EndOfMainFile
// CHECK-NEXT: ...

View File

@ -1,97 +1,97 @@
//===- clang-modernize/PerfSupportTest.cpp - PerfSupport unit tests -------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "gtest/gtest.h"
#include "Core/PerfSupport.h"
using namespace llvm;
using namespace clang;
class TransformA : public Transform {
public:
TransformA(const TransformOptions &Options)
: Transform("TransformA", Options) {}
virtual int apply(const tooling::CompilationDatabase &,
const std::vector<std::string> &) {
return 0;
}
void addTiming(StringRef Label, TimeRecord Duration) {
Transform::addTiming(Label, Duration);
}
};
class TransformB : public Transform {
public:
TransformB(const TransformOptions &Options)
: Transform("TransformB", Options) {}
virtual int apply(const tooling::CompilationDatabase &,
const std::vector<std::string> &) {
return 0;
}
void addTiming(StringRef Label, TimeRecord Duration) {
Transform::addTiming(Label, Duration);
}
};
struct ExpectedResults {
const char *SourceName;
unsigned DataCount;
struct Datum {
const char *Label;
float Duration;
} Data[2];
};
TEST(PerfSupport, collectSourcePerfData) {
TransformOptions Options;
TransformA A(Options);
TransformB B(Options);
// The actual durations don't matter. Below only their relative ordering is
// tested to ensure times, labels, and sources all stay together properly.
A.addTiming("FileA.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
A.addTiming("FileC.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
B.addTiming("FileC.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
B.addTiming("FileB.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
SourcePerfData PerfData;
collectSourcePerfData(A, PerfData);
SourcePerfData::const_iterator FileAI = PerfData.find("FileA.cpp");
EXPECT_NE(FileAI, PerfData.end());
SourcePerfData::const_iterator FileCI = PerfData.find("FileC.cpp");
EXPECT_NE(FileCI, PerfData.end());
EXPECT_EQ(2u, PerfData.size());
EXPECT_EQ(1u, FileAI->second.size());
EXPECT_EQ("TransformA", FileAI->second[0].Label);
EXPECT_EQ(1u, FileCI->second.size());
EXPECT_EQ("TransformA", FileCI->second[0].Label);
EXPECT_LE(FileAI->second[0].Duration, FileCI->second[0].Duration);
collectSourcePerfData(B, PerfData);
SourcePerfData::const_iterator FileBI = PerfData.find("FileB.cpp");
EXPECT_NE(FileBI, PerfData.end());
EXPECT_EQ(3u, PerfData.size());
EXPECT_EQ(1u, FileAI->second.size());
EXPECT_EQ("TransformA", FileAI->second[0].Label);
EXPECT_EQ(2u, FileCI->second.size());
EXPECT_EQ("TransformA", FileCI->second[0].Label);
EXPECT_EQ("TransformB", FileCI->second[1].Label);
EXPECT_LE(FileCI->second[0].Duration, FileCI->second[1].Duration);
EXPECT_EQ(1u, FileBI->second.size());
EXPECT_EQ("TransformB", FileBI->second[0].Label);
EXPECT_LE(FileCI->second[1].Duration, FileBI->second[0].Duration);
}
//===- clang-modernize/PerfSupportTest.cpp - PerfSupport unit tests -------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "gtest/gtest.h"
#include "Core/PerfSupport.h"
using namespace llvm;
using namespace clang;
class TransformA : public Transform {
public:
TransformA(const TransformOptions &Options)
: Transform("TransformA", Options) {}
virtual int apply(const tooling::CompilationDatabase &,
const std::vector<std::string> &) {
return 0;
}
void addTiming(StringRef Label, TimeRecord Duration) {
Transform::addTiming(Label, Duration);
}
};
class TransformB : public Transform {
public:
TransformB(const TransformOptions &Options)
: Transform("TransformB", Options) {}
virtual int apply(const tooling::CompilationDatabase &,
const std::vector<std::string> &) {
return 0;
}
void addTiming(StringRef Label, TimeRecord Duration) {
Transform::addTiming(Label, Duration);
}
};
struct ExpectedResults {
const char *SourceName;
unsigned DataCount;
struct Datum {
const char *Label;
float Duration;
} Data[2];
};
TEST(PerfSupport, collectSourcePerfData) {
TransformOptions Options;
TransformA A(Options);
TransformB B(Options);
// The actual durations don't matter. Below only their relative ordering is
// tested to ensure times, labels, and sources all stay together properly.
A.addTiming("FileA.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
A.addTiming("FileC.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
B.addTiming("FileC.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
B.addTiming("FileB.cpp", TimeRecord::getCurrentTime(/*Start=*/true));
SourcePerfData PerfData;
collectSourcePerfData(A, PerfData);
SourcePerfData::const_iterator FileAI = PerfData.find("FileA.cpp");
EXPECT_NE(FileAI, PerfData.end());
SourcePerfData::const_iterator FileCI = PerfData.find("FileC.cpp");
EXPECT_NE(FileCI, PerfData.end());
EXPECT_EQ(2u, PerfData.size());
EXPECT_EQ(1u, FileAI->second.size());
EXPECT_EQ("TransformA", FileAI->second[0].Label);
EXPECT_EQ(1u, FileCI->second.size());
EXPECT_EQ("TransformA", FileCI->second[0].Label);
EXPECT_LE(FileAI->second[0].Duration, FileCI->second[0].Duration);
collectSourcePerfData(B, PerfData);
SourcePerfData::const_iterator FileBI = PerfData.find("FileB.cpp");
EXPECT_NE(FileBI, PerfData.end());
EXPECT_EQ(3u, PerfData.size());
EXPECT_EQ(1u, FileAI->second.size());
EXPECT_EQ("TransformA", FileAI->second[0].Label);
EXPECT_EQ(2u, FileCI->second.size());
EXPECT_EQ("TransformA", FileCI->second[0].Label);
EXPECT_EQ("TransformB", FileCI->second[1].Label);
EXPECT_LE(FileCI->second[0].Duration, FileCI->second[1].Duration);
EXPECT_EQ(1u, FileBI->second.size());
EXPECT_EQ("TransformB", FileBI->second[0].Label);
EXPECT_LE(FileCI->second[1].Duration, FileBI->second[0].Duration);
}

View File

@ -661,8 +661,8 @@ Decl *TemplateDeclInstantiator::VisitIndirectFieldDecl(IndirectFieldDecl *D) {
SemaRef.Context, Owner, D->getLocation(), D->getIdentifier(), T,
NamedChain, D->getChainingSize());
for (const auto *Attr : D->attrs())
IndirectField->addAttr(Attr->clone(SemaRef.Context));
for (const auto *Attr : D->attrs())
IndirectField->addAttr(Attr->clone(SemaRef.Context));
IndirectField->setImplicit(D->isImplicit());
IndirectField->setAccess(D->getAccess());

View File

@ -1,12 +1,12 @@
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s
#pragma detect_mismatch("test", "1")
#define BAR "2"
#pragma detect_mismatch("test2", BAR)
// CHECK: !llvm.module.flags = !{{{.*}}}
// CHECK: !{{[0-9]+}} = metadata !{i32 6, metadata !"Linker Options", metadata ![[link_opts:[0-9]+]]}
// CHECK: ![[link_opts]] = metadata !{metadata ![[test:[0-9]+]], metadata ![[test2:[0-9]+]]}
// CHECK: ![[test]] = metadata !{metadata !"/FAILIFMISMATCH:\22test=1\22"}
// CHECK: ![[test2]] = metadata !{metadata !"/FAILIFMISMATCH:\22test2=2\22"}
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s
#pragma detect_mismatch("test", "1")
#define BAR "2"
#pragma detect_mismatch("test2", BAR)
// CHECK: !llvm.module.flags = !{{{.*}}}
// CHECK: !{{[0-9]+}} = metadata !{i32 6, metadata !"Linker Options", metadata ![[link_opts:[0-9]+]]}
// CHECK: ![[link_opts]] = metadata !{metadata ![[test:[0-9]+]], metadata ![[test2:[0-9]+]]}
// CHECK: ![[test]] = metadata !{metadata !"/FAILIFMISMATCH:\22test=1\22"}
// CHECK: ![[test2]] = metadata !{metadata !"/FAILIFMISMATCH:\22test2=2\22"}

View File

@ -1,23 +1,23 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -ffake-address-space-map -triple i686-pc-darwin | FileCheck %s
typedef struct {
int cells[9];
} Mat3X3;
typedef struct {
int cells[16];
} Mat4X4;
Mat4X4 __attribute__((noinline)) foo(Mat3X3 in) {
Mat4X4 out;
return out;
}
kernel void ker(global Mat3X3 *in, global Mat4X4 *out) {
out[0] = foo(in[1]);
}
// Expect two mem copies: one for the argument "in", and one for
// the return value.
// CHECK: call void @llvm.memcpy.p0i8.p1i8.i32(i8*
// CHECK: call void @llvm.memcpy.p1i8.p0i8.i32(i8 addrspace(1)*
// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -ffake-address-space-map -triple i686-pc-darwin | FileCheck %s
typedef struct {
int cells[9];
} Mat3X3;
typedef struct {
int cells[16];
} Mat4X4;
Mat4X4 __attribute__((noinline)) foo(Mat3X3 in) {
Mat4X4 out;
return out;
}
kernel void ker(global Mat3X3 *in, global Mat4X4 *out) {
out[0] = foo(in[1]);
}
// Expect two mem copies: one for the argument "in", and one for
// the return value.
// CHECK: call void @llvm.memcpy.p0i8.p1i8.i32(i8*
// CHECK: call void @llvm.memcpy.p1i8.p0i8.i32(i8 addrspace(1)*

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple arm-apple-darwin -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
__attribute__((interrupt)) void Test(void);
// CHECK: FunctionDecl{{.*}}Test
// CHECK-NEXT: ARMInterruptAttr
// RUN: %clang_cc1 -triple arm-apple-darwin -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
__attribute__((interrupt)) void Test(void);
// CHECK: FunctionDecl{{.*}}Test
// CHECK-NEXT: ARMInterruptAttr

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple msp430-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
__attribute__((interrupt(12))) void Test(void);
// CHECK: FunctionDecl{{.*}}Test
// CHECK-NEXT: MSP430InterruptAttr
// RUN: %clang_cc1 -triple msp430-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
__attribute__((interrupt(12))) void Test(void);
// CHECK: FunctionDecl{{.*}}Test
// CHECK-NEXT: MSP430InterruptAttr

View File

@ -1,16 +1,16 @@
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s
void f(int i) __attribute__((format_arg(1)));
// CHECK: attr-source-range.cpp:3:30:{3:41-3:42}{3:8-3:13}
void g(int i, ...) __attribute__((format(printf, 1, 1)));
// CHECK: attr-source-range.cpp:6:35:{6:50-6:51}{6:8-6:13}
int h(void) __attribute__((returns_nonnull));
// CHECK: attr-source-range.cpp:9:28:{9:1-9:4}
void i(int j) __attribute__((nonnull(1)));
// CHECK: attr-source-range.cpp:12:30:{12:38-12:39}{12:8-12:13}
void j(__attribute__((nonnull)) int i);
// CHECK: attr-source-range.cpp:15:23:{15:8-15:38}
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s
void f(int i) __attribute__((format_arg(1)));
// CHECK: attr-source-range.cpp:3:30:{3:41-3:42}{3:8-3:13}
void g(int i, ...) __attribute__((format(printf, 1, 1)));
// CHECK: attr-source-range.cpp:6:35:{6:50-6:51}{6:8-6:13}
int h(void) __attribute__((returns_nonnull));
// CHECK: attr-source-range.cpp:9:28:{9:1-9:4}
void i(int j) __attribute__((nonnull(1)));
// CHECK: attr-source-range.cpp:12:30:{12:38-12:39}{12:8-12:13}
void j(__attribute__((nonnull)) int i);
// CHECK: attr-source-range.cpp:15:23:{15:8-15:38}

View File

@ -1,24 +1,24 @@
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t.a %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t.a %s -ast-print -o - | FileCheck %s
#ifndef HEADER
#define HEADER
inline void test(int i) {
switch (i) {
case 1:
// Notice that the NullStmt has two attributes.
// CHECK: {{\[\[clang::fallthrough\]\] \[\[clang::fallthrough\]\]}}
[[clang::fallthrough]] [[clang::fallthrough]];
case 2:
break;
}
}
#else
void foo(void) {
test(1);
}
#endif
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t.a %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t.a %s -ast-print -o - | FileCheck %s
#ifndef HEADER
#define HEADER
inline void test(int i) {
switch (i) {
case 1:
// Notice that the NullStmt has two attributes.
// CHECK: {{\[\[clang::fallthrough\]\] \[\[clang::fallthrough\]\]}}
[[clang::fallthrough]] [[clang::fallthrough]];
case 2:
break;
}
}
#else
void foo(void) {
test(1);
}
#endif

View File

@ -1,15 +1,15 @@
// RUN: %clang_cc1 -fsyntax-only %s
// Make sure OpenBSD's bounded extension is accepted.
typedef long ssize_t;
typedef unsigned long size_t;
typedef struct FILE FILE;
ssize_t read(int, void *, size_t)
__attribute__((__bounded__(__buffer__,2,3)));
int readlink(const char *, char *, size_t)
__attribute__((__bounded__(__string__,2,3)));
size_t fread(void *, size_t, size_t, FILE *)
__attribute__((__bounded__(__size__,1,3,2)));
char *getwd(char *)
__attribute__((__bounded__(__minbytes__,1,1024)));
// RUN: %clang_cc1 -fsyntax-only %s
// Make sure OpenBSD's bounded extension is accepted.
typedef long ssize_t;
typedef unsigned long size_t;
typedef struct FILE FILE;
ssize_t read(int, void *, size_t)
__attribute__((__bounded__(__buffer__,2,3)));
int readlink(const char *, char *, size_t)
__attribute__((__bounded__(__string__,2,3)));
size_t fread(void *, size_t, size_t, FILE *)
__attribute__((__bounded__(__size__,1,3,2)));
char *getwd(char *)
__attribute__((__bounded__(__minbytes__,1,1024)));

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple msp430-unknown-unknown -fsyntax-only -verify %s
int i;
void f(void) __attribute__((interrupt(i))); /* expected-error {{'interrupt' attribute requires an integer constant}} */
void f2(void) __attribute__((interrupt(12)));
// RUN: %clang_cc1 -triple msp430-unknown-unknown -fsyntax-only -verify %s
int i;
void f(void) __attribute__((interrupt(i))); /* expected-error {{'interrupt' attribute requires an integer constant}} */
void f2(void) __attribute__((interrupt(12)));

View File

@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
void f1(int *a1, int *a2, int *a3, int *a4, int *a5, int *a6, int *a7,
int *a8, int *a9, int *a10, int *a11, int *a12, int *a13, int *a14,
int *a15, int *a16) __attribute__((nonnull(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)));
void f2(void) __attribute__((nonnull())); // expected-warning {{'nonnull' attribute applied to function with no pointer arguments}}
// RUN: %clang_cc1 %s -verify -fsyntax-only
void f1(int *a1, int *a2, int *a3, int *a4, int *a5, int *a6, int *a7,
int *a8, int *a9, int *a10, int *a11, int *a12, int *a13, int *a14,
int *a15, int *a16) __attribute__((nonnull(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)));
void f2(void) __attribute__((nonnull())); // expected-warning {{'nonnull' attribute applied to function with no pointer arguments}}

View File

@ -1,265 +1,265 @@
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
// RUN: | FileCheck %s
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
// RUN: | FileCheck %s
typedef struct A {
char x;
int a : 22;
int : 0;
int c : 10;
char b : 3;
char d: 4;
short y;
} A;
// CHECK: Type: struct A
// CHECK: Size:128
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 32, 64, 64, 96, 99, 112]>
typedef struct B {
char x;
int : 0;
short a : 4;
char y;
} B;
// CHECK: Type: struct B
// CHECK: Size:48
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8, 16, 32]>
typedef struct C {
char x;
short a : 4;
int : 0;
char y;
} C;
// CHECK: Type: struct C
// CHECK: Size:64
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 16, 32, 32]>
typedef struct D {
char x;
short : 0;
int : 0;
char y;
} D;
// CHECK: Type: struct D
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 8]>
typedef union E {
char x;
long long a : 3;
int b : 3;
long long : 0;
short y;
} E;
// CHECK: Type: union E
// CHECK: Size:64
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct F {
char x;
char a : 3;
char b : 3;
char c : 3;
short d : 6;
short e : 6;
short f : 6;
short g : 11;
short h : 11;
short i : 11;
short y;
} F;
// CHECK: Type: struct F
// CHECK: Size:128
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8, 11, 16, 32, 38, 48, 64, 80, 96, 112]>
typedef union G {
char x;
int a : 3;
int : 0;
long long : 0;
short y;
} G;
// CHECK: Type: union G
// CHECK: Size:32
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct H {
unsigned short a : 1;
unsigned char : 0;
unsigned long : 0;
unsigned short c : 1;
} H;
// CHECK: Type: struct H
// CHECK: Size:32
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 16, 16, 16]>
typedef struct I {
short : 8;
__declspec(align(16)) short : 8;
} I;
// CHECK: Type: struct I
// CHECK: Size:16
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8]
#pragma pack(push, 1)
typedef struct A1 {
char x;
int a : 22;
int : 0;
int c : 10;
char b : 3;
char d: 4;
short y;
} A1;
// CHECK: Type: struct A1
// CHECK: Size:96
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 40, 40, 72, 75, 80]>
typedef struct B1 {
char x;
int : 0;
short a : 4;
char y;
} B1;
// CHECK: Type: struct B1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 24]>
typedef struct C1 {
char x;
short a : 4;
int : 0;
char y;
} C1;
// CHECK: Type: struct C1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 24, 24]>
typedef struct D1 {
char x;
short : 0;
int : 0;
char y;
} D1;
// CHECK: Type: struct D1
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 8]>
typedef union E1 {
char x;
long long a : 3;
int b : 3;
long long : 0;
short y;
} E1;
// CHECK: Type: union E1
// CHECK: Size:64
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct F1 {
char x;
char a : 3;
char b : 3;
char c : 3;
short d : 6;
short e : 6;
short f : 6;
short g : 11;
short h : 11;
short i : 11;
short y;
} F1;
// CHECK: Type: struct F1
// CHECK: Size:120
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 11, 16, 24, 30, 40, 56, 72, 88, 104]>
typedef union G1 {
char x;
int a : 3;
int : 0;
long long : 0;
short y;
} G1;
// CHECK: Type: union G1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct H1 {
unsigned long a : 1;
unsigned char : 0;
unsigned long : 0;
unsigned long c : 1;
} H1;
// CHECK: Type: struct H1
// CHECK: Size:64
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 32, 32, 32]>
typedef struct I1 {
short : 8;
__declspec(align(16)) short : 8;
} I1;
// CHECK: Type: struct I1
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8]
#pragma pack(pop)
int x[
sizeof(A ) +
sizeof(B ) +
sizeof(C ) +
sizeof(D ) +
sizeof(E ) +
sizeof(F ) +
sizeof(G ) +
sizeof(H ) +
sizeof(I ) +
sizeof(A1) +
sizeof(B1) +
sizeof(C1) +
sizeof(D1) +
sizeof(E1) +
sizeof(F1) +
sizeof(G1) +
sizeof(H1) +
sizeof(I1) +
0];
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
// RUN: | FileCheck %s
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts %s 2>/dev/null \
// RUN: | FileCheck %s
typedef struct A {
char x;
int a : 22;
int : 0;
int c : 10;
char b : 3;
char d: 4;
short y;
} A;
// CHECK: Type: struct A
// CHECK: Size:128
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 32, 64, 64, 96, 99, 112]>
typedef struct B {
char x;
int : 0;
short a : 4;
char y;
} B;
// CHECK: Type: struct B
// CHECK: Size:48
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8, 16, 32]>
typedef struct C {
char x;
short a : 4;
int : 0;
char y;
} C;
// CHECK: Type: struct C
// CHECK: Size:64
// CHECK: Alignment:32
// CHECK: FieldOffsets: [0, 16, 32, 32]>
typedef struct D {
char x;
short : 0;
int : 0;
char y;
} D;
// CHECK: Type: struct D
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 8]>
typedef union E {
char x;
long long a : 3;
int b : 3;
long long : 0;
short y;
} E;
// CHECK: Type: union E
// CHECK: Size:64
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct F {
char x;
char a : 3;
char b : 3;
char c : 3;
short d : 6;
short e : 6;
short f : 6;
short g : 11;
short h : 11;
short i : 11;
short y;
} F;
// CHECK: Type: struct F
// CHECK: Size:128
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8, 11, 16, 32, 38, 48, 64, 80, 96, 112]>
typedef union G {
char x;
int a : 3;
int : 0;
long long : 0;
short y;
} G;
// CHECK: Type: union G
// CHECK: Size:32
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct H {
unsigned short a : 1;
unsigned char : 0;
unsigned long : 0;
unsigned short c : 1;
} H;
// CHECK: Type: struct H
// CHECK: Size:32
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 16, 16, 16]>
typedef struct I {
short : 8;
__declspec(align(16)) short : 8;
} I;
// CHECK: Type: struct I
// CHECK: Size:16
// CHECK: Alignment:16
// CHECK: FieldOffsets: [0, 8]
#pragma pack(push, 1)
typedef struct A1 {
char x;
int a : 22;
int : 0;
int c : 10;
char b : 3;
char d: 4;
short y;
} A1;
// CHECK: Type: struct A1
// CHECK: Size:96
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 40, 40, 72, 75, 80]>
typedef struct B1 {
char x;
int : 0;
short a : 4;
char y;
} B1;
// CHECK: Type: struct B1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 24]>
typedef struct C1 {
char x;
short a : 4;
int : 0;
char y;
} C1;
// CHECK: Type: struct C1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 24, 24]>
typedef struct D1 {
char x;
short : 0;
int : 0;
char y;
} D1;
// CHECK: Type: struct D1
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 8, 8]>
typedef union E1 {
char x;
long long a : 3;
int b : 3;
long long : 0;
short y;
} E1;
// CHECK: Type: union E1
// CHECK: Size:64
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct F1 {
char x;
char a : 3;
char b : 3;
char c : 3;
short d : 6;
short e : 6;
short f : 6;
short g : 11;
short h : 11;
short i : 11;
short y;
} F1;
// CHECK: Type: struct F1
// CHECK: Size:120
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8, 11, 16, 24, 30, 40, 56, 72, 88, 104]>
typedef union G1 {
char x;
int a : 3;
int : 0;
long long : 0;
short y;
} G1;
// CHECK: Type: union G1
// CHECK: Size:32
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 0, 0, 0, 0]>
typedef struct H1 {
unsigned long a : 1;
unsigned char : 0;
unsigned long : 0;
unsigned long c : 1;
} H1;
// CHECK: Type: struct H1
// CHECK: Size:64
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 32, 32, 32]>
typedef struct I1 {
short : 8;
__declspec(align(16)) short : 8;
} I1;
// CHECK: Type: struct I1
// CHECK: Size:16
// CHECK: Alignment:8
// CHECK: FieldOffsets: [0, 8]
#pragma pack(pop)
int x[
sizeof(A ) +
sizeof(B ) +
sizeof(C ) +
sizeof(D ) +
sizeof(E ) +
sizeof(F ) +
sizeof(G ) +
sizeof(H ) +
sizeof(I ) +
sizeof(A1) +
sizeof(B1) +
sizeof(C1) +
sizeof(D1) +
sizeof(E1) +
sizeof(F1) +
sizeof(G1) +
sizeof(H1) +
sizeof(I1) +
0];

View File

@ -1 +1 @@
#define rsqrt(x) (1.f/sqrt(x))
#define rsqrt(x) (1.f/sqrt(x))

View File

@ -29,7 +29,7 @@ class DenseSet {
public:
typedef ValueT key_type;
typedef ValueT value_type;
typedef unsigned size_type;
typedef unsigned size_type;
explicit DenseSet(unsigned NumInitBuckets = 0) : TheMap(NumInitBuckets) {}
@ -45,7 +45,7 @@ public:
TheMap.clear();
}
/// Return 1 if the specified key is in the set, 0 otherwise.
/// Return 1 if the specified key is in the set, 0 otherwise.
size_type count(const ValueT &V) const {
return TheMap.count(V);
}

View File

@ -148,7 +148,7 @@ public:
/// ScopeTy - This is a helpful typedef that allows clients to get easy access
/// to the name of the scope for this hash table.
typedef ScopedHashTableScope<K, V, KInfo, AllocatorTy> ScopeTy;
typedef unsigned size_type;
typedef unsigned size_type;
private:
typedef ScopedHashTableVal<K, V> ValTy;
DenseMap<K, ValTy*, KInfo> TopLevelMap;
@ -171,7 +171,7 @@ public:
AllocatorTy &getAllocator() { return Allocator; }
const AllocatorTy &getAllocator() const { return Allocator; }
/// Return 1 if the specified key is in the table, 0 otherwise.
/// Return 1 if the specified key is in the table, 0 otherwise.
size_type count(const K &Key) const {
return TopLevelMap.count(Key);
}

View File

@ -54,7 +54,7 @@ class SmallBitVector {
};
public:
typedef unsigned size_type;
typedef unsigned size_type;
// Encapsulation of a single bit.
class reference {
SmallBitVector &TheVector;

View File

@ -45,7 +45,7 @@ struct SparseBitVectorElement
: public ilist_node<SparseBitVectorElement<ElementSize> > {
public:
typedef unsigned long BitWord;
typedef unsigned size_type;
typedef unsigned size_type;
enum {
BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE,

View File

@ -185,7 +185,7 @@ public:
typedef const ValueT &const_reference;
typedef ValueT *pointer;
typedef const ValueT *const_pointer;
typedef unsigned size_type;
typedef unsigned size_type;
SparseMultiSet()
: Sparse(nullptr), Universe(0), FreelistIdx(SMSNode::INVALID), NumFree(0) {}

View File

@ -124,7 +124,7 @@ class SparseSet {
typedef typename KeyFunctorT::argument_type KeyT;
typedef SmallVector<ValueT, 8> DenseT;
typedef unsigned size_type;
typedef unsigned size_type;
DenseT Dense;
SparseT *Sparse;
unsigned Universe;

View File

@ -1,115 +1,115 @@
//===-- HexagonDisassembler.cpp - Disassembler for Hexagon ISA ------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/HexagonBaseInfo.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixedLenDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MemoryObject.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Endian.h"
#include <vector>
#include <array>
using namespace llvm;
#define DEBUG_TYPE "hexagon-disassembler"
// Pull DecodeStatus and its enum values into the global namespace.
typedef llvm::MCDisassembler::DecodeStatus DecodeStatus;
namespace {
/// \brief Hexagon disassembler for all Hexagon platforms.
class HexagonDisassembler : public MCDisassembler {
public:
HexagonDisassembler(MCSubtargetInfo const &STI, MCContext &Ctx)
: MCDisassembler(STI, Ctx) {}
DecodeStatus getInstruction(MCInst &instr, uint64_t &size,
MemoryObject const &region, uint64_t address,
raw_ostream &vStream, raw_ostream &cStream) const override;
};
}
static const uint16_t IntRegDecoderTable[] = {
Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4,
Hexagon::R5, Hexagon::R6, Hexagon::R7, Hexagon::R8, Hexagon::R9,
Hexagon::R10, Hexagon::R11, Hexagon::R12, Hexagon::R13, Hexagon::R14,
Hexagon::R15, Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23, Hexagon::R24,
Hexagon::R25, Hexagon::R26, Hexagon::R27, Hexagon::R28, Hexagon::R29,
Hexagon::R30, Hexagon::R31};
static const uint16_t PredRegDecoderTable[] = {Hexagon::P0, Hexagon::P1,
Hexagon::P2, Hexagon::P3};
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
void const *Decoder) {
if (RegNo > 31)
return MCDisassembler::Fail;
unsigned Register = IntRegDecoderTable[RegNo];
Inst.addOperand(MCOperand::CreateReg(Register));
return MCDisassembler::Success;
}
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
void const *Decoder) {
if (RegNo > 3)
return MCDisassembler::Fail;
unsigned Register = PredRegDecoderTable[RegNo];
Inst.addOperand(MCOperand::CreateReg(Register));
return MCDisassembler::Success;
}
#include "HexagonGenDisassemblerTables.inc"
static MCDisassembler *createHexagonDisassembler(Target const &T,
MCSubtargetInfo const &STI,
MCContext &Ctx) {
return new HexagonDisassembler(STI, Ctx);
}
extern "C" void LLVMInitializeHexagonDisassembler() {
TargetRegistry::RegisterMCDisassembler(TheHexagonTarget,
createHexagonDisassembler);
}
DecodeStatus HexagonDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
MemoryObject const &Region,
uint64_t Address,
raw_ostream &os,
raw_ostream &cs) const {
std::array<uint8_t, 4> Bytes;
Size = 4;
if (Region.readBytes(Address, Bytes.size(), Bytes.data()) == -1) {
return MCDisassembler::Fail;
}
uint32_t insn =
llvm::support::endian::read<uint32_t, llvm::support::little,
llvm::support::unaligned>(Bytes.data());
// Remove parse bits.
insn &= ~static_cast<uint32_t>(HexagonII::InstParseBits::INST_PARSE_MASK);
return decodeInstruction(DecoderTable32, MI, insn, Address, this, STI);
}
//===-- HexagonDisassembler.cpp - Disassembler for Hexagon ISA ------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/HexagonBaseInfo.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixedLenDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MemoryObject.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Endian.h"
#include <vector>
#include <array>
using namespace llvm;
#define DEBUG_TYPE "hexagon-disassembler"
// Pull DecodeStatus and its enum values into the global namespace.
typedef llvm::MCDisassembler::DecodeStatus DecodeStatus;
namespace {
/// \brief Hexagon disassembler for all Hexagon platforms.
class HexagonDisassembler : public MCDisassembler {
public:
HexagonDisassembler(MCSubtargetInfo const &STI, MCContext &Ctx)
: MCDisassembler(STI, Ctx) {}
DecodeStatus getInstruction(MCInst &instr, uint64_t &size,
MemoryObject const &region, uint64_t address,
raw_ostream &vStream, raw_ostream &cStream) const override;
};
}
static const uint16_t IntRegDecoderTable[] = {
Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4,
Hexagon::R5, Hexagon::R6, Hexagon::R7, Hexagon::R8, Hexagon::R9,
Hexagon::R10, Hexagon::R11, Hexagon::R12, Hexagon::R13, Hexagon::R14,
Hexagon::R15, Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23, Hexagon::R24,
Hexagon::R25, Hexagon::R26, Hexagon::R27, Hexagon::R28, Hexagon::R29,
Hexagon::R30, Hexagon::R31};
static const uint16_t PredRegDecoderTable[] = {Hexagon::P0, Hexagon::P1,
Hexagon::P2, Hexagon::P3};
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
void const *Decoder) {
if (RegNo > 31)
return MCDisassembler::Fail;
unsigned Register = IntRegDecoderTable[RegNo];
Inst.addOperand(MCOperand::CreateReg(Register));
return MCDisassembler::Success;
}
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
void const *Decoder) {
if (RegNo > 3)
return MCDisassembler::Fail;
unsigned Register = PredRegDecoderTable[RegNo];
Inst.addOperand(MCOperand::CreateReg(Register));
return MCDisassembler::Success;
}
#include "HexagonGenDisassemblerTables.inc"
static MCDisassembler *createHexagonDisassembler(Target const &T,
MCSubtargetInfo const &STI,
MCContext &Ctx) {
return new HexagonDisassembler(STI, Ctx);
}
extern "C" void LLVMInitializeHexagonDisassembler() {
TargetRegistry::RegisterMCDisassembler(TheHexagonTarget,
createHexagonDisassembler);
}
DecodeStatus HexagonDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
MemoryObject const &Region,
uint64_t Address,
raw_ostream &os,
raw_ostream &cs) const {
std::array<uint8_t, 4> Bytes;
Size = 4;
if (Region.readBytes(Address, Bytes.size(), Bytes.data()) == -1) {
return MCDisassembler::Fail;
}
uint32_t insn =
llvm::support::endian::read<uint32_t, llvm::support::little,
llvm::support::unaligned>(Bytes.data());
// Remove parse bits.
insn &= ~static_cast<uint32_t>(HexagonII::InstParseBits::INST_PARSE_MASK);
return decodeInstruction(DecoderTable32, MI, insn, Address, this, STI);
}

View File

@ -17,14 +17,14 @@
#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
#include "HexagonMCTargetDesc.h"
#include "llvm/Support/ErrorHandling.h"
#include <stdint.h>
namespace llvm {
/// HexagonII - This namespace holds all of the target specific flags that
#include "HexagonMCTargetDesc.h"
#include "llvm/Support/ErrorHandling.h"
#include <stdint.h>
namespace llvm {
/// HexagonII - This namespace holds all of the target specific flags that
/// instruction info tracks.
///
namespace HexagonII {
@ -188,20 +188,20 @@ namespace HexagonII {
MO_LO16, MO_HI16,
// Offset from the base of the SDA.
MO_GPREL
};
enum class InstParseBits : uint32_t {
INST_PARSE_MASK = 0x0000c000,
INST_PARSE_PACKET_END = 0x0000c000,
INST_PARSE_LOOP_END = 0x00008000,
INST_PARSE_NOT_END = 0x00004000,
INST_PARSE_DUPLEX = 0x00000000,
INST_PARSE_EXTENDER = 0x00000000
};
} // End namespace HexagonII.
} // End namespace llvm.
MO_GPREL
};
enum class InstParseBits : uint32_t {
INST_PARSE_MASK = 0x0000c000,
INST_PARSE_PACKET_END = 0x0000c000,
INST_PARSE_LOOP_END = 0x00008000,
INST_PARSE_NOT_END = 0x00004000,
INST_PARSE_DUPLEX = 0x00000000,
INST_PARSE_EXTENDER = 0x00000000
};
} // End namespace HexagonII.
} // End namespace llvm.
#endif