-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assembling "j 0x10" fails with "error: instruction requires: ", Mask == 32 #23
Comments
You also need to specify the CPU. The following works for me:
The reason that diff --git a/lib/Target/RISCV/RISCVInstrInfo.td b/lib/Target/RISCV/RISCVInstrInfo.td
index 2a69abc..5ba7eb4 100644
--- a/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/lib/Target/RISCV/RISCVInstrInfo.td
@@ -12,17 +12,17 @@
*/
def IsRV32 : Predicate<"Subtarget.isRV32()">,
- AssemblerPredicate<"FeatureRV32">;
+ AssemblerPredicate<"FeatureRV32", "RV32">;
def IsRV64 : Predicate<"Subtarget.isRV64()">,
- AssemblerPredicate<"FeatureRV64">;
+ AssemblerPredicate<"FeatureRV64", "RV64">;
def HasM : Predicate<"Subtarget.hasM()">,
- AssemblerPredicate<"FeatureM">;
+ AssemblerPredicate<"FeatureM", "M">;
def HasF : Predicate<"Subtarget.hasF()">,
- AssemblerPredicate<"FeatureF">;
+ AssemblerPredicate<"FeatureF", "F">;
def HasD : Predicate<"Subtarget.hasD()">,
- AssemblerPredicate<"FeatureD">;
+ AssemblerPredicate<"FeatureD", "D">;
def HasA : Predicate<"Subtarget.hasA()">,
- AssemblerPredicate<"FeatureA">;
+ AssemblerPredicate<"FeatureA", "A">; There is also an issue in RISCVMCTargetDesc.cpp that might be related to this. The MCInstrInfo for the RISCV64 target is not registered. The following patch fixes that: diff --git a/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp b/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
index 4cac6c0..8f1c26b 100644
--- a/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
+++ b/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
@@ -143,7 +143,7 @@ extern "C" void LLVMInitializeRISCVTargetMC() {
// Register the MCInstrInfo.
TargetRegistry::RegisterMCInstrInfo(TheRISCVTarget,
createRISCVMCInstrInfo);
- TargetRegistry::RegisterMCInstrInfo(TheRISCVTarget,
+ TargetRegistry::RegisterMCInstrInfo(TheRISCV64Target,
createRISCVMCInstrInfo); My riscv-llvm tree is currently quite out of date so the line numbers in the above patches might not be correct. |
Thanks for taking a look. Your patch works (as far as I can see). |
Hi,
I did the following:
With the following (ugly) patch to help debugging:
Somehow
getSubtargetFeatureName(32);
returns an empty string.The text was updated successfully, but these errors were encountered: