From 4d0327e819e10a5e6a884919551be1c6ba6cf490 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 20 Mar 2018 11:26:50 +0000 Subject: [PATCH] Revert "Fix layering between llvm-c and Support by factoring out some typedefs into Support" This reverts r327940 because it fails on several GreenDragon bots. http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/ http://green.lab.llvm.org/green/job/clang-stage2-coverage-R/ llvm-svn: 327968 --- include/llvm-c/Disassembler.h | 38 ++++++++++++- include/llvm/Support/DisassemblerTypedefs.h | 60 --------------------- include/llvm/Support/TargetRegistry.h | 2 +- 3 files changed, 38 insertions(+), 62 deletions(-) delete mode 100644 include/llvm/Support/DisassemblerTypedefs.h diff --git a/include/llvm-c/Disassembler.h b/include/llvm-c/Disassembler.h index 9d2b380f46c..d6f92e505d3 100644 --- a/include/llvm-c/Disassembler.h +++ b/include/llvm-c/Disassembler.h @@ -16,7 +16,6 @@ #define LLVM_C_DISASSEMBLER_H #include "llvm/Support/DataTypes.h" -#include "llvm/Support/DisassemblerTypedefs.h" #ifdef __cplusplus #include #else @@ -35,6 +34,26 @@ */ typedef void *LLVMDisasmContextRef; +/** + * The type for the operand information call back function. This is called to + * get the symbolic information for an operand of an instruction. Typically + * this is from the relocation information, symbol table, etc. That block of + * information is saved when the disassembler context is created and passed to + * the call back in the DisInfo parameter. The instruction containing operand + * is at the PC parameter. For some instruction sets, there can be more than + * one operand with symbolic information. To determine the symbolic operand + * information for each operand, the bytes for the specific operand in the + * instruction are specified by the Offset parameter and its byte widith is the + * size parameter. For instructions sets with fixed widths and one symbolic + * operand per instruction, the Offset parameter will be zero and Size parameter + * will be the instruction width. The information is returned in TagBuf and is + * Triple specific with its specific information defined by the value of + * TagType for that Triple. If symbolic information is returned the function + * returns 1, otherwise it returns 0. + */ +typedef int (*LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, + uint64_t Offset, uint64_t Size, + int TagType, void *TagBuf); /** * The initial support in LLVM MC for the most general form of a relocatable @@ -90,6 +109,23 @@ struct LLVMOpInfo1 { #define LLVMDisassembler_VariantKind_ARM64_TLVP 5 /* @tvlppage */ #define LLVMDisassembler_VariantKind_ARM64_TLVOFF 6 /* @tvlppageoff */ +/** + * The type for the symbol lookup function. This may be called by the + * disassembler for things like adding a comment for a PC plus a constant + * offset load instruction to use a symbol name instead of a load address value. + * It is passed the block information is saved when the disassembler context is + * created and the ReferenceValue to look up as a symbol. If no symbol is found + * for the ReferenceValue NULL is returned. The ReferenceType of the + * instruction is passed indirectly as is the PC of the instruction in + * ReferencePC. If the output reference can be determined its type is returned + * indirectly in ReferenceType along with ReferenceName if any, or that is set + * to NULL. + */ +typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo, + uint64_t ReferenceValue, + uint64_t *ReferenceType, + uint64_t ReferencePC, + const char **ReferenceName); /** * The reference types on input and output. */ diff --git a/include/llvm/Support/DisassemblerTypedefs.h b/include/llvm/Support/DisassemblerTypedefs.h deleted file mode 100644 index f275cb9bd8b..00000000000 --- a/include/llvm/Support/DisassemblerTypedefs.h +++ /dev/null @@ -1,60 +0,0 @@ -//===- Support/DisassemblerTypedefs.h ---------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Typedefs used across the boundary between Support and the C API. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_DISASSEMBLERTYPEDEFS_H -#define LLVM_SUPPORT_DISASSEMBLERTYPEDEFS_H -#ifdef __cplusplus -#include -#else -#include -#endif - -/** - * The type for the operand information call back function. This is called to - * get the symbolic information for an operand of an instruction. Typically - * this is from the relocation information, symbol table, etc. That block of - * information is saved when the disassembler context is created and passed to - * the call back in the DisInfo parameter. The instruction containing operand - * is at the PC parameter. For some instruction sets, there can be more than - * one operand with symbolic information. To determine the symbolic operand - * information for each operand, the bytes for the specific operand in the - * instruction are specified by the Offset parameter and its byte widith is the - * size parameter. For instructions sets with fixed widths and one symbolic - * operand per instruction, the Offset parameter will be zero and Size parameter - * will be the instruction width. The information is returned in TagBuf and is - * Triple specific with its specific information defined by the value of - * TagType for that Triple. If symbolic information is returned the function - * returns 1, otherwise it returns 0. - */ -typedef int (*LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, - uint64_t Offset, uint64_t Size, - int TagType, void *TagBuf); - -/** - * The type for the symbol lookup function. This may be called by the - * disassembler for things like adding a comment for a PC plus a constant - * offset load instruction to use a symbol name instead of a load address value. - * It is passed the block information is saved when the disassembler context is - * created and the ReferenceValue to look up as a symbol. If no symbol is found - * for the ReferenceValue NULL is returned. The ReferenceType of the - * instruction is passed indirectly as is the PC of the instruction in - * ReferencePC. If the output reference can be determined its type is returned - * indirectly in ReferenceType along with ReferenceName if any, or that is set - * to NULL. - */ -typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo, - uint64_t ReferenceValue, - uint64_t *ReferenceType, - uint64_t ReferencePC, - const char **ReferenceName); -#endif diff --git a/include/llvm/Support/TargetRegistry.h b/include/llvm/Support/TargetRegistry.h index 0bcb8ba1545..8a429ab728e 100644 --- a/include/llvm/Support/TargetRegistry.h +++ b/include/llvm/Support/TargetRegistry.h @@ -19,12 +19,12 @@ #ifndef LLVM_SUPPORT_TARGETREGISTRY_H #define LLVM_SUPPORT_TARGETREGISTRY_H +#include "llvm-c/Disassembler.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/CodeGen.h" -#include "llvm/Support/DisassemblerTypedefs.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include