Fold a binary operator with constant operands when expanding code for a SCEV.
[llvm-complete.git] / lib / Archive / ArchiveInternals.h
blob4642f7a30abb4d2b9f3b6c0124b50aaf7d11434d
1 //===-- lib/Bytecode/ArchiveInternals.h -------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Internal implementation header for LLVM Archive files.
12 //===----------------------------------------------------------------------===//
14 #ifndef LIB_BYTECODE_ARCHIVEINTERNALS_H
15 #define LIB_BYTECODE_ARCHIVEINTERNALS_H
17 #include "llvm/Bitcode/Archive.h"
18 #include "llvm/System/TimeValue.h"
19 #include "llvm/ADT/StringExtras.h"
21 #define ARFILE_MAGIC "!<arch>\n" ///< magic string
22 #define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string
23 #define ARFILE_SVR4_SYMTAB_NAME "/ " ///< SVR4 symtab entry name
24 #define ARFILE_LLVM_SYMTAB_NAME "#_LLVM_SYM_TAB_#" ///< LLVM symtab entry name
25 #define ARFILE_BSD4_SYMTAB_NAME "__.SYMDEF SORTED" ///< BSD4 symtab entry name
26 #define ARFILE_STRTAB_NAME "// " ///< Name of string table
27 #define ARFILE_PAD "\n" ///< inter-file align padding
28 #define ARFILE_MEMBER_MAGIC "`\n" ///< fmag field magic #
30 namespace llvm {
32 /// The ArchiveMemberHeader structure is used internally for bytecode
33 /// archives.
34 /// The header precedes each file member in the archive. This structure is
35 /// defined using character arrays for direct and correct interpretation
36 /// regardless of the endianess of the machine that produced it.
37 /// @brief Archive File Member Header
38 class ArchiveMemberHeader {
39 /// @name Data
40 /// @{
41 public:
42 char name[16]; ///< Name of the file member.
43 char date[12]; ///< File date, decimal seconds since Epoch
44 char uid[6]; ///< user id in ASCII decimal
45 char gid[6]; ///< group id in ASCII decimal
46 char mode[8]; ///< file mode in ASCII octal
47 char size[10]; ///< file size in ASCII decimal
48 char fmag[2]; ///< Always contains ARFILE_MAGIC_TERMINATOR
50 /// @}
51 /// @name Methods
52 /// @{
53 public:
54 void init() {
55 memset(name,' ',16);
56 memset(date,' ',12);
57 memset(uid,' ',6);
58 memset(gid,' ',6);
59 memset(mode,' ',8);
60 memset(size,' ',10);
61 fmag[0] = '`';
62 fmag[1] = '\n';
65 bool checkSignature() {
66 return 0 == memcmp(fmag, ARFILE_MEMBER_MAGIC,2);
70 // Get just the externally visible defined symbols from the bytecode
71 bool GetBytecodeSymbols(const sys::Path& fName,
72 std::vector<std::string>& symbols,
73 std::string* ErrMsg);
75 ModuleProvider* GetBytecodeSymbols(const unsigned char*Buffer,unsigned Length,
76 const std::string& ModuleID,
77 std::vector<std::string>& symbols,
78 std::string* ErrMsg);
81 #endif
83 // vim: sw=2 ai