You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
3
external/llvm/projects/CMakeLists.txt
vendored
3
external/llvm/projects/CMakeLists.txt
vendored
@@ -12,7 +12,8 @@ foreach(entry ${entries})
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/test-suite) AND
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/parallel-libs) AND
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests))
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests) AND
|
||||
(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/llvm-cbe))
|
||||
add_subdirectory(${entry})
|
||||
endif()
|
||||
endif()
|
||||
|
21
external/llvm/projects/llvm-cbe/.gitignore
vendored
Normal file
21
external/llvm/projects/llvm-cbe/.gitignore
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
2
external/llvm/projects/llvm-cbe/CMakeLists.txt
vendored
Normal file
2
external/llvm/projects/llvm-cbe/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(tools)
|
57
external/llvm/projects/llvm-cbe/LICENSE
vendored
Normal file
57
external/llvm/projects/llvm-cbe/LICENSE
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
Developed by:
|
||||
LLVM Team
|
||||
University of Illinois at Urbana-Champaign
|
||||
http://llvm.org
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
==============================================================================
|
||||
Copyrights and Licenses for Third Party Software Distributed with LLVM:
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
Program Directory
|
||||
------- ---------
|
||||
Autoconf llvm/autoconf
|
||||
llvm/projects/ModuleMaker/autoconf
|
||||
llvm/projects/sample/autoconf
|
||||
Google Test llvm/utils/unittest/googletest
|
||||
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
|
||||
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
|
||||
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
|
||||
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
|
72
external/llvm/projects/llvm-cbe/README.md
vendored
Normal file
72
external/llvm/projects/llvm-cbe/README.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
llvm-cbe
|
||||
========
|
||||
|
||||
resurrected LLVM "C Backend", with improvements
|
||||
|
||||
|
||||
INSTALLATION INSTRUCTIONS
|
||||
=========================
|
||||
|
||||
This version of the LLVM-CBE library works with LLVM 6.0 and 7.0. You will have
|
||||
to compile this version of LLVM before you try to use LLVM-CBE. This
|
||||
guide will walk you through the compilation and installation of both
|
||||
tools and show usage statements to verify that the LLVM-CBE library is
|
||||
compiled correctly.
|
||||
|
||||
The library is known to compile on various Linux versions (Redhat,
|
||||
Mageia, Ubuntu, Debian), Mac OS X, and Windows (Mingw-w64).
|
||||
|
||||
Step 1: Installing LLVM
|
||||
=======================
|
||||
|
||||
LLVM-CBE relies on specific LLVM internals, and so it is best to use
|
||||
it with a specific revision of the LLVM development tree. Currently,
|
||||
llvm-cbe works with the LLVM 6.0 and 7.0 release versions and autotools.
|
||||
|
||||
Note: to convert C to LLVM IR to run the tests, you will also need a C compiler such as clang.
|
||||
|
||||
The first step is to compile LLVM on your machine
|
||||
(this assumes an in-tree build, but out-of-tree will also work):
|
||||
|
||||
cd $HOME
|
||||
git clone https://github.com/llvm-mirror/llvm
|
||||
cd llvm
|
||||
git checkout release_37
|
||||
mkdir build
|
||||
cd build
|
||||
../configure
|
||||
make
|
||||
|
||||
Step 2: Compiling LLVM-CBE
|
||||
==========================
|
||||
|
||||
Next, download and compile llvm-cbe from the same folder:
|
||||
|
||||
cd $HOME/llvm/projects
|
||||
git clone https://github.com/JuliaComputing/llvm-cbe
|
||||
cd ../build
|
||||
make
|
||||
|
||||
Step 3: Usage Examples
|
||||
======================
|
||||
|
||||
If llvm-cbe compiles, you should be able to run it with the following commands.
|
||||
```
|
||||
$ cd $HOME/llvm/projects/llvm-cbe/test/selectionsort
|
||||
$ ls
|
||||
main.c
|
||||
$ clang -S -emit-llvm main.c
|
||||
$ ls
|
||||
main.c main.ll
|
||||
$ $(HOME)/llvm/build/Debug+Asserts/bin/llvm-cbe main.ll
|
||||
```
|
||||
|
||||
Compile Generated C-Code and Run
|
||||
================================
|
||||
|
||||
```
|
||||
$ gcc -o main.cbe main.cbe.c
|
||||
$ ls
|
||||
main.c main.cbe main.cbe.c main.ll
|
||||
$ ./main.cbe
|
||||
```
|
6
external/llvm/projects/llvm-cbe/docs/index.html
vendored
Normal file
6
external/llvm/projects/llvm-cbe/docs/index.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>SAMPLE PROJECT DOCUMENTATION</h1>
|
||||
<p>This is just a placeholder</p>
|
||||
</body>
|
||||
</html>
|
8
external/llvm/projects/llvm-cbe/include/sample.h
vendored
Normal file
8
external/llvm/projects/llvm-cbe/include/sample.h
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* File: sample.h
|
||||
*
|
||||
* This is a sample header file that is global to the entire project.
|
||||
* It is located here so that everyone will find it.
|
||||
*/
|
||||
extern int compute_sample (int a);
|
||||
|
1
external/llvm/projects/llvm-cbe/lib/CMakeLists.txt
vendored
Normal file
1
external/llvm/projects/llvm-cbe/lib/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
add_subdirectory(Target)
|
1
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp.REMOVED.git-id
vendored
Normal file
1
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp.REMOVED.git-id
vendored
Normal file
@@ -0,0 +1 @@
|
||||
4d2af4c2a0589f2de37eb6097b2c6d6753aaef14
|
260
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h
vendored
Normal file
260
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
|
||||
#include "CTargetMachine.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/IR/Attributes.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/CFG.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/IR/InstVisitor.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCInstrInfo.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace {
|
||||
using namespace llvm;
|
||||
|
||||
class CBEMCAsmInfo : public MCAsmInfo {
|
||||
public:
|
||||
CBEMCAsmInfo() {
|
||||
PrivateGlobalPrefix = "";
|
||||
}
|
||||
};
|
||||
|
||||
/// CWriter - This class is the main chunk of code that converts an LLVM
|
||||
/// module to a C translation unit.
|
||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||
std::string _Out;
|
||||
raw_string_ostream Out;
|
||||
raw_pwrite_stream &FileOut;
|
||||
IntrinsicLowering *IL;
|
||||
LoopInfo *LI;
|
||||
const Module *TheModule;
|
||||
const MCAsmInfo* TAsm;
|
||||
const MCRegisterInfo *MRI;
|
||||
const MCObjectFileInfo *MOFI;
|
||||
MCContext *TCtx;
|
||||
const DataLayout* TD;
|
||||
|
||||
std::map<const ConstantFP *, unsigned> FPConstantMap;
|
||||
std::set<const Argument*> ByValParams;
|
||||
unsigned FPCounter;
|
||||
unsigned OpaqueCounter;
|
||||
|
||||
DenseMap<const Value*, unsigned> AnonValueNumbers;
|
||||
unsigned NextAnonValueNumber;
|
||||
|
||||
/// UnnamedStructIDs - This contains a unique ID for each struct that is
|
||||
/// either anonymous or has no name.
|
||||
DenseMap<StructType*, unsigned> UnnamedStructIDs;
|
||||
unsigned NextAnonStructNumber;
|
||||
|
||||
std::set<Type*> TypedefDeclTypes;
|
||||
std::set<Type*> SelectDeclTypes;
|
||||
std::set<std::pair<CmpInst::Predicate, VectorType*>> CmpDeclTypes;
|
||||
std::set<std::pair<CastInst::CastOps, std::pair<Type*, Type*>>> CastOpDeclTypes;
|
||||
std::set<std::pair<unsigned, Type*>> InlineOpDeclTypes;
|
||||
std::set<Type*> CtorDeclTypes;
|
||||
|
||||
DenseMap<std::pair<FunctionType*, std::pair<AttributeList, CallingConv::ID>>, unsigned> UnnamedFunctionIDs;
|
||||
unsigned NextFunctionNumber;
|
||||
|
||||
// This is used to keep track of intrinsics that get generated to a lowered
|
||||
// function. We must generate the prototypes before the function body which
|
||||
// will only be expanded on first use
|
||||
std::vector<Function*> prototypesToGen;
|
||||
|
||||
public:
|
||||
static char ID;
|
||||
explicit CWriter(raw_pwrite_stream &o)
|
||||
: FunctionPass(ID), Out(_Out), FileOut(o), IL(0), LI(0),
|
||||
TheModule(0), TAsm(0), MRI(0), MOFI(0), TCtx(0), TD(0),
|
||||
OpaqueCounter(0), NextAnonValueNumber(0),
|
||||
NextAnonStructNumber(0), NextFunctionNumber(0) {
|
||||
FPCounter = 0;
|
||||
}
|
||||
|
||||
virtual StringRef getPassName() const { return "C backend"; }
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<LoopInfoWrapperPass>();
|
||||
AU.setPreservesCFG();
|
||||
}
|
||||
|
||||
virtual bool doInitialization(Module &M);
|
||||
virtual bool doFinalization(Module &M);
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
private:
|
||||
|
||||
void generateHeader(Module &M);
|
||||
void declareOneGlobalVariable(GlobalVariable* I);
|
||||
|
||||
void forwardDeclareStructs(raw_ostream &Out, Type *Ty, std::set<Type*> &TypesPrinted);
|
||||
void forwardDeclareFunctionTypedefs(raw_ostream &Out, Type *Ty, std::set<Type*> &TypesPrinted);
|
||||
|
||||
raw_ostream &printFunctionProto(raw_ostream &Out, FunctionType *Ty,
|
||||
std::pair<AttributeList, CallingConv::ID> Attrs,
|
||||
const std::string &Name,
|
||||
iterator_range<Function::arg_iterator> *ArgList);
|
||||
raw_ostream &printFunctionProto(raw_ostream &Out, Function *F) {
|
||||
return printFunctionProto(Out, F->getFunctionType(), std::make_pair(F->getAttributes(), F->getCallingConv()), GetValueName(F), NULL);
|
||||
}
|
||||
|
||||
raw_ostream &printFunctionDeclaration(raw_ostream &Out, FunctionType *Ty,
|
||||
std::pair<AttributeList, CallingConv::ID> PAL = std::make_pair(AttributeList(), CallingConv::C));
|
||||
raw_ostream &printStructDeclaration(raw_ostream &Out, StructType *Ty);
|
||||
raw_ostream &printArrayDeclaration(raw_ostream &Out, ArrayType *Ty);
|
||||
raw_ostream &printVectorDeclaration(raw_ostream &Out, VectorType *Ty);
|
||||
|
||||
raw_ostream &printTypeName(raw_ostream &Out, Type *Ty, bool isSigned = false, std::pair<AttributeList, CallingConv::ID> PAL = std::make_pair(AttributeList(), CallingConv::C));
|
||||
raw_ostream &printTypeNameUnaligned(raw_ostream &Out, Type *Ty, bool isSigned = false);
|
||||
raw_ostream &printSimpleType(raw_ostream &Out, Type *Ty, bool isSigned);
|
||||
raw_ostream &printTypeString(raw_ostream &Out, Type *Ty, bool isSigned);
|
||||
|
||||
std::string getStructName(StructType *ST);
|
||||
std::string getFunctionName(FunctionType *FT, std::pair<AttributeList, CallingConv::ID> PAL = std::make_pair(AttributeList(), CallingConv::C));
|
||||
std::string getArrayName(ArrayType *AT);
|
||||
std::string getVectorName(VectorType *VT, bool Aligned);
|
||||
|
||||
enum OperandContext {
|
||||
ContextNormal,
|
||||
ContextCasted,
|
||||
// Casted context means the type-cast will be implicit,
|
||||
// such as the RHS of a `var = RHS;` expression
|
||||
// or inside a struct initializer expression
|
||||
ContextStatic
|
||||
// Static context means that it is being used in as a static initializer
|
||||
// (also implies ContextCasted)
|
||||
};
|
||||
|
||||
void writeOperandDeref(Value *Operand);
|
||||
void writeOperand(Value *Operand, enum OperandContext Context = ContextNormal);
|
||||
void writeInstComputationInline(Instruction &I);
|
||||
void writeOperandInternal(Value *Operand, enum OperandContext Context = ContextNormal);
|
||||
void writeOperandWithCast(Value* Operand, unsigned Opcode);
|
||||
void opcodeNeedsCast(unsigned Opcode, bool &shouldCast, bool &castIsSigned);
|
||||
|
||||
void writeOperandWithCast(Value* Operand, ICmpInst &I);
|
||||
bool writeInstructionCast(Instruction &I);
|
||||
void writeMemoryAccess(Value *Operand, Type *OperandType,
|
||||
bool IsVolatile, unsigned Alignment);
|
||||
|
||||
std::string InterpretASMConstraint(InlineAsm::ConstraintInfo& c);
|
||||
|
||||
void lowerIntrinsics(Function &F);
|
||||
/// Prints the definition of the intrinsic function F. Supports the
|
||||
/// intrinsics which need to be explicitly defined in the CBackend.
|
||||
void printIntrinsicDefinition(Function &F, raw_ostream &Out);
|
||||
void printIntrinsicDefinition(FunctionType *funT,
|
||||
unsigned Opcode, std::string OpName,
|
||||
raw_ostream &Out);
|
||||
|
||||
void printModuleTypes(raw_ostream &Out);
|
||||
void printContainedTypes(raw_ostream &Out, Type *Ty, std::set<Type*> &);
|
||||
|
||||
void printFloatingPointConstants(Function &F);
|
||||
void printFloatingPointConstants(const Constant *C);
|
||||
|
||||
void printFunction(Function &);
|
||||
void printBasicBlock(BasicBlock *BB);
|
||||
void printLoop(Loop *L);
|
||||
|
||||
void printCast(unsigned opcode, Type *SrcTy, Type *DstTy);
|
||||
void printConstant(Constant *CPV, enum OperandContext Context);
|
||||
void printConstantWithCast(Constant *CPV, unsigned Opcode);
|
||||
bool printConstExprCast(ConstantExpr *CE);
|
||||
void printConstantArray(ConstantArray *CPA, enum OperandContext Context);
|
||||
void printConstantVector(ConstantVector *CV, enum OperandContext Context);
|
||||
void printConstantDataSequential(ConstantDataSequential *CDS, enum OperandContext Context);
|
||||
bool printConstantString(Constant *C, enum OperandContext Context);
|
||||
|
||||
bool isEmptyType(Type *Ty) const;
|
||||
bool isAddressExposed(Value *V) const;
|
||||
bool isInlinableInst(Instruction &I) const;
|
||||
AllocaInst *isDirectAlloca(Value *V) const;
|
||||
bool isInlineAsm(Instruction& I) const;
|
||||
|
||||
// Instruction visitation functions
|
||||
friend class InstVisitor<CWriter>;
|
||||
|
||||
void visitReturnInst(ReturnInst &I);
|
||||
void visitBranchInst(BranchInst &I);
|
||||
void visitSwitchInst(SwitchInst &I);
|
||||
void visitIndirectBrInst(IndirectBrInst &I);
|
||||
void visitInvokeInst(InvokeInst &I) {
|
||||
llvm_unreachable("Lowerinvoke pass didn't work!");
|
||||
}
|
||||
void visitResumeInst(ResumeInst &I) {
|
||||
llvm_unreachable("DwarfEHPrepare pass didn't work!");
|
||||
}
|
||||
void visitUnreachableInst(UnreachableInst &I);
|
||||
|
||||
void visitPHINode(PHINode &I);
|
||||
void visitBinaryOperator(BinaryOperator &I);
|
||||
void visitICmpInst(ICmpInst &I);
|
||||
void visitFCmpInst(FCmpInst &I);
|
||||
|
||||
void visitCastInst (CastInst &I);
|
||||
void visitSelectInst(SelectInst &I);
|
||||
void visitCallInst (CallInst &I);
|
||||
void visitInlineAsm(CallInst &I);
|
||||
bool visitBuiltinCall(CallInst &I, Intrinsic::ID ID);
|
||||
|
||||
void visitAllocaInst(AllocaInst &I);
|
||||
void visitLoadInst (LoadInst &I);
|
||||
void visitStoreInst (StoreInst &I);
|
||||
void visitGetElementPtrInst(GetElementPtrInst &I);
|
||||
void visitVAArgInst (VAArgInst &I);
|
||||
|
||||
void visitInsertElementInst(InsertElementInst &I);
|
||||
void visitExtractElementInst(ExtractElementInst &I);
|
||||
void visitShuffleVectorInst(ShuffleVectorInst &SVI);
|
||||
|
||||
void visitInsertValueInst(InsertValueInst &I);
|
||||
void visitExtractValueInst(ExtractValueInst &I);
|
||||
|
||||
void visitInstruction(Instruction &I) {
|
||||
#ifndef NDEBUG
|
||||
errs() << "C Writer does not know about " << I;
|
||||
#endif
|
||||
llvm_unreachable(0);
|
||||
}
|
||||
|
||||
void outputLValue(Instruction *I) {
|
||||
Out << " " << GetValueName(I) << " = ";
|
||||
}
|
||||
|
||||
bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To);
|
||||
void printPHICopiesForSuccessor(BasicBlock *CurBlock,
|
||||
BasicBlock *Successor, unsigned Indent);
|
||||
void printBranchToBlock(BasicBlock *CurBlock, BasicBlock *SuccBlock,
|
||||
unsigned Indent);
|
||||
void printGEPExpression(Value *Ptr, gep_type_iterator I, gep_type_iterator E);
|
||||
|
||||
std::string GetValueName(Value *Operand);
|
||||
};
|
||||
}
|
5
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt
vendored
Normal file
5
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
add_llvm_target(CBackendCodeGen
|
||||
CBackend.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(TargetInfo)
|
44
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h
vendored
Normal file
44
external/llvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
//===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the TargetMachine that is used by the C backend.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CTARGETMACHINE_H
|
||||
#define CTARGETMACHINE_H
|
||||
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
struct CTargetMachine : public TargetMachine {
|
||||
CTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
||||
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||
Optional<CodeModel::Model> CM, CodeGenOpt::Level OL, bool JIT)
|
||||
: TargetMachine(T, "", TT, CPU, FS, Options) { }
|
||||
|
||||
/// Add passes to the specified pass manager to get the specified file
|
||||
/// emitted. Typically this will involve several steps of code generation.
|
||||
bool addPassesToEmitFile(
|
||||
PassManagerBase &PM, raw_pwrite_stream &Out,
|
||||
#if LLVM_VERSION_MAJOR == 7
|
||||
raw_pwrite_stream *DwoOut,
|
||||
#endif
|
||||
CodeGenFileType FileType, bool DisableVerify=true, MachineModuleInfo *MMI=nullptr) override;
|
||||
|
||||
};
|
||||
|
||||
extern Target TheCBackendTarget;
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
|
||||
#endif
|
31
external/llvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt
vendored
Normal file
31
external/llvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
;===- ./lib/Target/CBackend/LLVMBuild.txt ----------------------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = TargetInfo
|
||||
|
||||
[component_0]
|
||||
type = TargetGroup
|
||||
name = CBackend
|
||||
parent = Target
|
||||
|
||||
[component_1]
|
||||
type = Library
|
||||
name = CBackendCodeGen
|
||||
parent = CBackend
|
||||
required_libraries = Analysis CBackendInfo CodeGen Core MC Scalar Support Target TransformUtils
|
||||
add_to_library_groups = CBackend
|
21
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
vendored
Normal file
21
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
//===-- CBackendTargetInfo.cpp - CBackend Target Implementation -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "../CTargetMachine.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
Target llvm::TheCBackendTarget;
|
||||
|
||||
extern "C" void LLVMInitializeCBackendTargetInfo() {
|
||||
RegisterTarget<> X(TheCBackendTarget, "c", "C backend", "C");
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeCBackendTargetMC() {}
|
5
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt
vendored
Normal file
5
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||
|
||||
add_llvm_library(LLVMCBackendInfo
|
||||
CBackendTargetInfo.cpp
|
||||
)
|
23
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt
vendored
Normal file
23
external/llvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
;===- ./lib/Target/CBackend/TargetInfo/LLVMBuild.txt -----------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = CBackendInfo
|
||||
parent = CBackend
|
||||
required_libraries = MC Support Target
|
||||
add_to_library_groups = CBackend
|
1
external/llvm/projects/llvm-cbe/lib/Target/CMakeLists.txt
vendored
Normal file
1
external/llvm/projects/llvm-cbe/lib/Target/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
add_subdirectory(CBackend)
|
5
external/llvm/projects/llvm-cbe/test/.gitignore
vendored
Normal file
5
external/llvm/projects/llvm-cbe/test/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
*.ll
|
||||
*.exe
|
||||
*.cbe
|
||||
*.cexe
|
||||
*.cbe.c
|
31
external/llvm/projects/llvm-cbe/test/CBEWarningsErrors.txt
vendored
Normal file
31
external/llvm/projects/llvm-cbe/test/CBEWarningsErrors.txt
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
CBE Warnings/Errors
|
||||
|
||||
1. "warning: conflicting types for built-in function
|
||||
|
||||
‘memcpy’ [enabled by default]"
|
||||
|
||||
Affecting:
|
||||
test093.cbe.c:126:23
|
||||
test095.cbe.c:121:23
|
||||
|
||||
This warning is generated when an array is declared and
|
||||
|
||||
initialized in the same line.
|
||||
|
||||
/*-----------------------*/
|
||||
|
||||
2. "error: cannot convert to a pointer type"
|
||||
|
||||
Affecting:
|
||||
test089.cbe.c:158:3
|
||||
test091.cbe.c:143:3
|
||||
|
||||
/*-----------------------*/
|
||||
|
||||
3. "warning: cast from pointer to integer of different size
|
||||
|
||||
[-Wpointer-to-int-cast]"
|
||||
|
||||
Affecting:
|
||||
test101.cbe.c:214:10
|
||||
test101.cbe.c:214:43
|
39
external/llvm/projects/llvm-cbe/test/selectionsort/main.c
vendored
Normal file
39
external/llvm/projects/llvm-cbe/test/selectionsort/main.c
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int array[100], n, c, d, position, swap;
|
||||
|
||||
printf("Enter number of elements\n");
|
||||
scanf("%d", &n);
|
||||
|
||||
printf("Enter %d integers\n", n);
|
||||
|
||||
for (c = 0; c < n; c++)
|
||||
scanf("%d", &array[c]);
|
||||
|
||||
for (c = 0; c < (n - 1); c++)
|
||||
{
|
||||
position = c;
|
||||
|
||||
for (d = c +1; d < n; d++)
|
||||
{
|
||||
if (array[position] > array[d])
|
||||
position = d;
|
||||
}
|
||||
if (position != c)
|
||||
{
|
||||
swap = array[c];
|
||||
array[c] = array[position];
|
||||
array[position] = swap;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Sorted list in ascending order:\n");
|
||||
|
||||
for (c = 0; c < n; c++)
|
||||
printf("%d\n", array[c]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user