[llvm] r291085 - MC: support passing search paths to the IAS
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 21:56:39 PST 2017
Author: compnerd
Date: Wed Jan 4 23:56:39 2017
New Revision: 291085
URL: http://llvm.org/viewvc/llvm-project?rev=291085&view=rev
Log:
MC: support passing search paths to the IAS
This is needed to support inclusion in inline assembly via the
`.include` directive.
Added:
llvm/trunk/test/MC/AsmParser/include/
llvm/trunk/test/MC/AsmParser/include.ll
llvm/trunk/test/MC/AsmParser/include/function.x
llvm/trunk/test/MC/AsmParser/include/module.x
Modified:
llvm/trunk/include/llvm/MC/MCTargetOptions.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/trunk/tools/llc/llc.cpp
Modified: llvm/trunk/include/llvm/MC/MCTargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCTargetOptions.h?rev=291085&r1=291084&r2=291085&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCTargetOptions.h (original)
+++ llvm/trunk/include/llvm/MC/MCTargetOptions.h Wed Jan 4 23:56:39 2017
@@ -11,6 +11,7 @@
#define LLVM_MC_MCTARGETOPTIONS_H
#include <string>
+#include <vector>
namespace llvm {
@@ -51,11 +52,17 @@ public:
bool PreserveAsmComments : 1;
int DwarfVersion;
+
/// getABIName - If this returns a non-empty string this represents the
/// textual name of the ABI that we want the backend to use, e.g. o32, or
/// aapcs-linux.
StringRef getABIName() const;
std::string ABIName;
+
+ /// Additional paths to search for `.include` directives when using the
+ /// integrated assembler.
+ std::vector<std::string> IASSearchPaths;
+
MCTargetOptions();
};
@@ -75,7 +82,8 @@ inline bool operator==(const MCTargetOpt
ARE_EQUAL(ShowMCInst) &&
ARE_EQUAL(AsmVerbose) &&
ARE_EQUAL(DwarfVersion) &&
- ARE_EQUAL(ABIName));
+ ARE_EQUAL(ABIName) &&
+ ARE_EQUAL(IASSearchPaths));
#undef ARE_EQUAL
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=291085&r1=291084&r2=291085&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Wed Jan 4 23:56:39 2017
@@ -100,6 +100,8 @@ void AsmPrinter::EmitInlineAsm(StringRef
}
SourceMgr SrcMgr;
+ SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths);
+
SrcMgrDiagInfo DiagInfo;
// If the current LLVMContext has an inline asm handler, set it in SourceMgr.
Added: llvm/trunk/test/MC/AsmParser/include.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/include.ll?rev=291085&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/include.ll (added)
+++ llvm/trunk/test/MC/AsmParser/include.ll Wed Jan 4 23:56:39 2017
@@ -0,0 +1,13 @@
+; RUN: llc -mtriple thumbv7--- -I %p/include -filetype asm -o - %s | FileCheck %s
+
+module asm ".include \22module.x\22"
+
+define arm_aapcscc void @f() {
+entry:
+ call void asm sideeffect ".include \22function.x\22", ""()
+ ret void
+}
+
+; CHECK: MODULE = 1
+; CHECK: FUNCTION = 1
+
Added: llvm/trunk/test/MC/AsmParser/include/function.x
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/include/function.x?rev=291085&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/include/function.x (added)
+++ llvm/trunk/test/MC/AsmParser/include/function.x Wed Jan 4 23:56:39 2017
@@ -0,0 +1,3 @@
+
+FUNCTION = 1
+
Added: llvm/trunk/test/MC/AsmParser/include/module.x
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/include/module.x?rev=291085&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/include/module.x (added)
+++ llvm/trunk/test/MC/AsmParser/include/module.x Wed Jan 4 23:56:39 2017
@@ -0,0 +1,3 @@
+
+MODULE = 1
+
Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=291085&r1=291084&r2=291085&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Wed Jan 4 23:56:39 2017
@@ -134,6 +134,8 @@ static cl::opt<std::string> StartAfter("
cl::desc("Resume compilation after a specific pass"),
cl::value_desc("pass-name"), cl::init(""));
+static cl::list<std::string> IncludeDirs("I", cl::desc("include search path"));
+
namespace {
static ManagedStatic<std::vector<std::string>> RunPassNames;
@@ -398,6 +400,7 @@ static int compileModule(char **argv, LL
Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
Options.MCOptions.AsmVerbose = AsmVerbose;
Options.MCOptions.PreserveAsmComments = PreserveComments;
+ Options.MCOptions.IASSearchPaths = IncludeDirs;
std::unique_ptr<TargetMachine> Target(
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
More information about the llvm-commits
mailing list